mirror of
https://github.com/motajs/template.git
synced 2026-11-18 02:04:30 +08:00
test(08-10): cover data-common/data-base gap codes and align baseline failures
- sandbox: drop obsolete playing=true bypass, align expired-step case, assert codes 73/194 - tileStore: assert codes 133/134 and add ItemStore/EnemyStore code 181 cases - map/mover: assert code 192 when Dir8 handler missing - hero/items: assert code 193 on missing item id registration - mapLifecycle: drive resize via GameMap.resizeLayer so shared indexer width syncs
This commit is contained in:
1 parent
339f72d541
commit
b932f8cecd
5 files changed
+127
-28
No files matched your search
@@ -6,9 +6,11 @@ import {
|
||||
type IItemRawData,
|
||||
ItemCategory,
|
||||
ItemStore,
|
||||
SaveCompression,
|
||||
TileStore,
|
||||
TileType
|
||||
} from '@user/data-common';
|
||||
import { logger } from '@motajs/common';
|
||||
import { HeroItems } from '../items';
|
||||
|
||||
vi.hoisted(() => {
|
||||
@@ -182,6 +184,25 @@ describe('HeroItems counting', () => {
|
||||
expect(env.items.itemCount(99)).toBe(0);
|
||||
expect(env.items.itemCount(77)).toBe(0);
|
||||
});
|
||||
|
||||
// 验证读档时道具无图块 id 注册告警码 193 并跳过该道具
|
||||
it('warns code 193 when a saved item has no tile id registration', () => {
|
||||
const env = createEnv();
|
||||
const warn = vi.spyOn(logger, 'warn');
|
||||
// 仅向道具存储注册定义,不向图块存储注册 id
|
||||
env.itemStore.addItem(
|
||||
createItem(50, 'orphan', ItemCategory.Constant).item
|
||||
);
|
||||
const save = env.items.saveState(SaveCompression.NoCompression);
|
||||
|
||||
env.items.loadState(
|
||||
{ items: [{ num: 50, count: 1 }], equipStore: save.equipStore },
|
||||
SaveCompression.NoCompression
|
||||
);
|
||||
|
||||
expect(warn).toHaveBeenCalledWith(193, '50');
|
||||
expect(env.items.itemCount(50)).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('HeroItems useItem', () => {
|
||||
|
||||
Reference in new issue
Block a user