add test case

This commit is contained in:
yanyongyu
2020-12-20 12:09:30 +08:00
parent 1b00fe7921
commit e44cde0600
2 changed files with 29 additions and 12 deletions

View File

@ -8,9 +8,14 @@ async def heartbeat(bot: Bot, event: Event, state: T_State) -> bool:
return isinstance(event, HeartbeatMetaEvent)
test_matcher = on_metaevent(heartbeat)
async def factory(bot: Bot, event: Event) -> T_State:
return {"factory": True}
test_matcher = on_metaevent(heartbeat, state_factory=factory)
@test_matcher.receive()
async def handle_heartbeat(bot: Bot, event: Event, state: T_State):
print(state)
print("[i] Heartbeat")