Improved support to act on cards via ID
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -12,7 +12,7 @@ class Command::ParserTest < ActionDispatch::IntegrationTest
|
||||
test "supports expressions in plain text" do
|
||||
command = parse_command "/assign @kevin"
|
||||
assert command.is_a?(Command::Assign)
|
||||
assert_equal [users(:kevin)], command.assignees
|
||||
assert_equal [ users(:kevin) ], command.assignees
|
||||
end
|
||||
|
||||
test "supports expressions in rich text" do
|
||||
@@ -20,6 +20,6 @@ class Command::ParserTest < ActionDispatch::IntegrationTest
|
||||
<p>/assign #{ActionText::Attachment.from_attachable(users(:kevin)).to_html}</p>
|
||||
HTML
|
||||
assert command.is_a?(Command::Assign)
|
||||
assert_equal [users(:kevin)], command.assignees
|
||||
assert_equal [ users(:kevin) ], command.assignees
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user