mirror of
https://github.com/motajs/template.git
synced 2026-11-12 14:04:31 +08:00
docs(test): describe individual test cases
This commit is contained in:
1 parent
4349e67669
commit
1d9b180d5f
6 files changed
+18
No files matched your search
@@ -47,6 +47,7 @@ function createEvent() {
|
||||
}
|
||||
|
||||
describe('GameEventStore public barrel behavior', () => {
|
||||
// 验证使用注册时的 ID 可以取回同一个事件
|
||||
it('retrieves an event by the id used when adding it', () => {
|
||||
const store = new modules.GameEventStore();
|
||||
const event = createEvent();
|
||||
@@ -56,12 +57,14 @@ describe('GameEventStore public barrel behavior', () => {
|
||||
expect(store.getEvent('event-id')).toBe(event);
|
||||
});
|
||||
|
||||
// 验证查询不存在的事件 ID 返回 null
|
||||
it('returns null for an unknown id', () => {
|
||||
const store = new modules.GameEventStore();
|
||||
|
||||
expect(store.getEvent('missing-id')).toBeNull();
|
||||
});
|
||||
|
||||
// 验证重复 ID 会告警并由后写入事件覆盖旧事件
|
||||
it('warns and overwrites when an id is added twice', () => {
|
||||
const store = new modules.GameEventStore();
|
||||
const firstEvent = createEvent();
|
||||
|
||||
Reference in new issue
Block a user