mirror of
https://github.com/motajs/template.git
synced 2026-11-11 21:44:31 +08:00
fix(replay): enable recording guard; update tests for replay refactor
This commit is contained in:
1 parent
17d7c8f46a
commit
c08f3f8484
7 files changed
+58
-70
No files matched your search
@@ -103,8 +103,12 @@ function createItem(
|
||||
function createEnv(): TestEnv {
|
||||
const tileStore = new TileStore();
|
||||
const itemStore = new ItemStore<IHeroAttr, unknown>();
|
||||
// 录像系统桩,仅用于满足装备/卸下时的 route.add 记录
|
||||
const replaySystem = { route: { add: vi.fn() } };
|
||||
// 录像系统桩,用于满足装备/卸下时的 route.add 记录与临时禁用录像
|
||||
const replaySystem = {
|
||||
route: { add: vi.fn() },
|
||||
disable: vi.fn(),
|
||||
revert: vi.fn()
|
||||
};
|
||||
const state = { tileStore, itemStore, replaySystem } as never;
|
||||
const attribute = new HeroAttribute<IHeroAttr>(createBaseAttr());
|
||||
const store = new HeroEquipsStore<IHeroAttr>(state);
|
||||
|
||||
@@ -118,16 +118,16 @@ describe('HeroMover configuration', () => {
|
||||
const mover = createMover();
|
||||
|
||||
expect(mover.getConfig()).toEqual({
|
||||
noRoute: false,
|
||||
ignoreTerrain: false,
|
||||
autoSave: false,
|
||||
allowOutBound: false
|
||||
});
|
||||
|
||||
expect(mover.config({ noRoute: true, autoSave: true })).toBe(mover);
|
||||
expect(mover.config({ ignoreTerrain: true, autoSave: true })).toBe(
|
||||
mover
|
||||
);
|
||||
expect(mover.getConfig()).toEqual({
|
||||
noRoute: true,
|
||||
ignoreTerrain: false,
|
||||
ignoreTerrain: true,
|
||||
autoSave: true,
|
||||
allowOutBound: false
|
||||
});
|
||||
|
||||
@@ -76,7 +76,11 @@ function createState(): IDataCommon {
|
||||
const tileStore = new TileStore();
|
||||
const itemStore = new ItemStore<IHeroAttr, unknown>();
|
||||
const route = { add: vi.fn() };
|
||||
return { tileStore, itemStore, replaySystem: { route } } as never;
|
||||
return {
|
||||
tileStore,
|
||||
itemStore,
|
||||
replaySystem: { route, disable: vi.fn(), revert: vi.fn() }
|
||||
} as never;
|
||||
}
|
||||
|
||||
/** 构造一份合成的勇士基础属性 */
|
||||
|
||||
Reference in new issue
Block a user