Skip to content

Commit

Permalink
Update tests/test_rule.py
Browse files Browse the repository at this point in the history
  • Loading branch information
yanyongyu authored Oct 18, 2023
1 parent 016db0b commit d840a7c
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions tests/test_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ async def test_trie(app: App):
command_whitespace=" ",
)

message = FakeMessageSegment.text("/fake-prefix") + FakeMessageSegment.text(
message = FakeMessageSegment.text("/fake-prefix ") + FakeMessageSegment.text(
" some args"
)
event = make_fake_event(_message=message)()
Expand All @@ -124,7 +124,23 @@ async def test_trie(app: App):
raw_command="/fake-prefix",
command_arg=FakeMessage("some args"),
command_start="/",
command_whitespace=" ",
command_whitespace=" ",
)

message = (
FakeMessageSegment.text("/fake-prefix ")
+ FakeMessageSegment.text(" ")
+ FakeMessageSegment.text(" some args")
)
event = make_fake_event(_message=message)()
state = {}
TrieRule.get_value(bot, event, state)
assert state[PREFIX_KEY] == CMD_RESULT(
command=("fake-prefix",),
raw_command="/fake-prefix",
command_arg=FakeMessage("some args"),
command_start="/",
command_whitespace=" ",
)

del TrieRule.prefix["/fake-prefix"]
Expand Down

0 comments on commit d840a7c

Please sign in to comment.