mirror of
https://github.com/motajs/template.git
synced 2026-10-10 14:47:22 +08:00
test(08-09): align remaining data-state integration and perf tests
- delete tileLegacy.test.ts (tested removed data-state/src/legacy; authorized retirement)
- dataClosure: local CoreState helper, Record equip.value, ReplayCommandResult/Active commands, natural sandbox step
- enemyCombination: local CoreState helper
- perf: CoreState loadStarter assembly, Record equip.value, addLayer('event')
This commit is contained in:
parent
98118fac14
commit
827e11c7a4
@ -1,44 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { TileStore } from '@user/data-common';
|
||||
import { LegacyTileData, TileLegacyBridge } from '../src/legacy/tile';
|
||||
|
||||
describe('TileLegacyBridge events-map contract', () => {
|
||||
// 验证旧样板事件对象会转换为 TileStore 可消费的默认事件映射
|
||||
it('converts legacy events into the TileStore event map', () => {
|
||||
const bridge = new TileLegacyBridge();
|
||||
const store = new TileStore<LegacyTileData>();
|
||||
store.attachLegacyConverter(bridge);
|
||||
const legacy: LegacyTileData = {
|
||||
id: 'yellowWall',
|
||||
cls: 'terrains',
|
||||
events: { 10: 'onEnter', 20: 'onTouch' },
|
||||
noPass: true
|
||||
};
|
||||
|
||||
const converted = store.fromLegacy(1, legacy);
|
||||
|
||||
expect(converted.events).toEqual({ 10: 'onEnter', 20: 'onTouch' });
|
||||
expect(store.getEvent(1)).toEqual(
|
||||
new Map([
|
||||
[10, 'onEnter'],
|
||||
[20, 'onTouch']
|
||||
])
|
||||
);
|
||||
expect(converted.eventPass).toBe(false);
|
||||
expect(converted).not.toHaveProperty('trigger');
|
||||
});
|
||||
|
||||
// 验证旧样板缺少事件输入时仍生成合法的空事件映射
|
||||
it('uses an empty events map when legacy input has no events', () => {
|
||||
const bridge = new TileLegacyBridge();
|
||||
const legacy: LegacyTileData = {
|
||||
id: 'whiteWall',
|
||||
cls: 'terrains'
|
||||
};
|
||||
|
||||
const converted = bridge.fromLegacy(2, legacy);
|
||||
|
||||
expect(converted.events).toEqual({});
|
||||
expect(converted).not.toHaveProperty('trigger');
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user