Improved support to act on cards via ID

This commit is contained in:
Jorge Manrubia
2025-07-03 13:08:56 +02:00
parent 75387891d5
commit a2ca8b1dc0
25 changed files with 27089 additions and 6 deletions
+8 -3
View File
@@ -3,8 +3,6 @@ require "test_helper"
class Command::Ai::TranslatorTest < ActionDispatch::IntegrationTest
include VcrTestHelper
vcr_record!
setup do
@user = users(:david)
end
@@ -45,12 +43,19 @@ class Command::Ai::TranslatorTest < ActionDispatch::IntegrationTest
end
test "filter by card id" do
# List context
assert_command({ context: { card_ids: [ 123 ] } }, "card 123")
assert_command({ context: { card_ids: [ 123, 456 ] } }, "card 123, 456")
assert_command({ context: { terms: [ "123" ] } }, "123") # Notice existing cards will be intercepted earlier
end
vcr_record!
test "acts on cards passing their ids" do
assert_command({ context: { card_ids: [ 123, 456 ] }, commands: [ "/close" ] }, "close 123 and 456")
assert_command({ context: { card_ids: [ 123 ] }, commands: [ "/close" ] }, "close 123")
assert_command({ context: { card_ids: [ 1, 5, 9 ] }, commands: [ "/assign #{users(:david).to_gid}" ] }, "assign 1, 5 and 9 to myself")
end
test "filter by collections" do
assert_command({ context: { collection_ids: [ "writebook" ] } }, "writebook collection")
end