Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我必须对向模拟端点发送 3 条消息的组件进行单元测试,但我只想测试第二条消息并忽略其他消息。我怎样才能做到这一点?我知道,将会有三个消息。我不在乎第一个和第三个...
如文档中所述,您可以使用mock.message(1)设置断言并对收到的第二条消息执行测试。
mock.message(1)