Skip to content

Commit

Permalink
test: fix xudt_tag worker test
Browse files Browse the repository at this point in the history
Signed-off-by: Miles Zhang <[email protected]>
  • Loading branch information
zmcNotafraid committed Jul 22, 2024
1 parent 52b8e74 commit 43204d4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/workers/xudt_tag_worker_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class XudtTagWorkerTest < ActiveJob::TestCase
assert_changes -> { XudtTag.count }, from: 0, to: 1 do
XudtTagWorker.new.perform
end
assert_equal ["unnamed"], XudtTag.last.tags
assert_equal ["unnamed", "rgb++"], XudtTag.last.tags
end

test "insert to xudt_tags successfully" do
Expand All @@ -36,31 +36,31 @@ class XudtTagWorkerTest < ActiveJob::TestCase
assert_changes -> { XudtTag.count }, from: 0, to: 1 do
XudtTagWorker.new.perform
end
assert_equal ["invalid"], XudtTag.last.tags
assert_equal ["invalid", "rgb++"], XudtTag.last.tags
end

test "insert suspicious tag" do
create(:udt, :xudt, symbol: "CK BB")
assert_changes -> { XudtTag.count }, from: 0, to: 1 do
XudtTagWorker.new.perform
end
assert_equal ["suspicious"], XudtTag.last.tags
assert_equal ["suspicious", "rgb++"], XudtTag.last.tags
end

test "insert out-of-length-range tag" do
create(:udt, :xudt, symbol: "CK BBBB")
assert_changes -> { XudtTag.count }, from: 0, to: 1 do
XudtTagWorker.new.perform
end
assert_equal ["out-of-length-range"], XudtTag.last.tags
assert_equal ["out-of-length-range", "rgb++"], XudtTag.last.tags
end

test "insert utility tag" do
create(:udt, :xudt, symbol: "CKBBB", args: "0xdd6faefeffaa7d2a7b2e6890713c5fa4bbf378add1cfc1b27672a50a6ad3e83500000040")
assert_changes -> { XudtTag.count }, from: 0, to: 1 do
XudtTagWorker.new.perform
end
assert_equal ["utility"], XudtTag.last.tags
assert_equal ["utility", "rgb++"], XudtTag.last.tags
end

test "insert suspicious tag when not lp token but duplicate" do
Expand All @@ -70,6 +70,6 @@ class XudtTagWorkerTest < ActiveJob::TestCase
assert_changes -> { XudtTag.count }, from: 1, to: 2 do
XudtTagWorker.new.perform
end
assert_equal ["suspicious"], XudtTag.last.tags
assert_equal ["suspicious", "rgb++"], XudtTag.last.tags
end
end

0 comments on commit 43204d4

Please sign in to comment.