mirror of
https://github.com/motajs/template.git
synced 2026-10-08 05:20:17 +08:00
test(08-01): migrate data-layer tests into __test__ dirs
Move 65 *.test.ts + 6 *.perf.ts across data-{common,base,system,state} into sibling __test__/ (data-state/test -> data-state/__test__), incl. fixtures/floors.json and non-test helpers; rewrite Rule A relative specifiers (+1 depth), keep Rule B unchanged; sync script/test-data-node.ts require paths. Gates: test:ci=66 files, test:perf=6 files, eslint clean, zero config/production changes.
This commit is contained in:
parent
109fad3b29
commit
36d8b4fb3c
@ -1,6 +1,6 @@
|
||||
// 测试 Enemy 数据模型:属性单元、特殊属性增删查、克隆与复制行为
|
||||
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest';
|
||||
import { type IEnemy, type ISpecial } from './types';
|
||||
import { type IEnemy, type ISpecial } from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -19,8 +19,8 @@ vi.hoisted(() => {
|
||||
});
|
||||
|
||||
interface TestModules {
|
||||
Enemy: typeof import('./enemy').Enemy;
|
||||
CommonSerializableSpecial: typeof import('./special').CommonSerializableSpecial;
|
||||
Enemy: typeof import('../enemy').Enemy;
|
||||
CommonSerializableSpecial: typeof import('../special').CommonSerializableSpecial;
|
||||
logger: typeof import('@motajs/common').logger;
|
||||
}
|
||||
|
||||
@ -29,8 +29,8 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const enemyModule = await import('./enemy');
|
||||
const specialModule = await import('./special');
|
||||
const enemyModule = await import('../enemy');
|
||||
const specialModule = await import('../special');
|
||||
const commonModule = await import('@motajs/common');
|
||||
modules = {
|
||||
Enemy: enemyModule.Enemy,
|
||||
@ -5,7 +5,7 @@ import {
|
||||
type IEnemyComparer,
|
||||
type IEnemyLegacyBridge,
|
||||
type IEnemyManager
|
||||
} from './types';
|
||||
} from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -24,8 +24,8 @@ vi.hoisted(() => {
|
||||
});
|
||||
|
||||
interface TestModules {
|
||||
Enemy: typeof import('./enemy').Enemy;
|
||||
EnemyManager: typeof import('./manager').EnemyManager;
|
||||
Enemy: typeof import('../enemy').Enemy;
|
||||
EnemyManager: typeof import('../manager').EnemyManager;
|
||||
logger: typeof import('@motajs/common').logger;
|
||||
}
|
||||
|
||||
@ -34,8 +34,8 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const enemyModule = await import('./enemy');
|
||||
const managerModule = await import('./manager');
|
||||
const enemyModule = await import('../enemy');
|
||||
const managerModule = await import('../manager');
|
||||
const commonModule = await import('@motajs/common');
|
||||
modules = {
|
||||
Enemy: enemyModule.Enemy,
|
||||
@ -6,7 +6,7 @@ import {
|
||||
type IEnemyLegacyBridge,
|
||||
type IEnemyManager,
|
||||
type ISpecial
|
||||
} from './types';
|
||||
} from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -25,10 +25,10 @@ vi.hoisted(() => {
|
||||
});
|
||||
|
||||
interface TestModules {
|
||||
Enemy: typeof import('./enemy').Enemy;
|
||||
CommonSerializableSpecial: typeof import('./special').CommonSerializableSpecial;
|
||||
NonePropertySpecial: typeof import('./special').NonePropertySpecial;
|
||||
EnemyManager: typeof import('./manager').EnemyManager;
|
||||
Enemy: typeof import('../enemy').Enemy;
|
||||
CommonSerializableSpecial: typeof import('../special').CommonSerializableSpecial;
|
||||
NonePropertySpecial: typeof import('../special').NonePropertySpecial;
|
||||
EnemyManager: typeof import('../manager').EnemyManager;
|
||||
logger: typeof import('@motajs/common').logger;
|
||||
}
|
||||
|
||||
@ -37,9 +37,9 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const enemyModule = await import('./enemy');
|
||||
const specialModule = await import('./special');
|
||||
const managerModule = await import('./manager');
|
||||
const enemyModule = await import('../enemy');
|
||||
const specialModule = await import('../special');
|
||||
const managerModule = await import('../manager');
|
||||
const commonModule = await import('@motajs/common');
|
||||
modules = {
|
||||
Enemy: enemyModule.Enemy,
|
||||
@ -1,7 +1,7 @@
|
||||
// 测试 special 数据模型:可序列化特殊属性的数值/名称/描述单元,以及无属性特殊属性
|
||||
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest';
|
||||
import { type ICommonSpecialConfig } from './special';
|
||||
import { type ISpecial } from './types';
|
||||
import { type ICommonSpecialConfig } from '../special';
|
||||
import { type ISpecial } from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -20,8 +20,8 @@ vi.hoisted(() => {
|
||||
});
|
||||
|
||||
interface TestModules {
|
||||
defineCommonSerializableSpecial: typeof import('./special').defineCommonSerializableSpecial;
|
||||
defineNonePropertySpecial: typeof import('./special').defineNonePropertySpecial;
|
||||
defineCommonSerializableSpecial: typeof import('../special').defineCommonSerializableSpecial;
|
||||
defineNonePropertySpecial: typeof import('../special').defineNonePropertySpecial;
|
||||
}
|
||||
|
||||
let modules: TestModules;
|
||||
@ -29,7 +29,7 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const specialModule = await import('./special');
|
||||
const specialModule = await import('../special');
|
||||
modules = {
|
||||
defineCommonSerializableSpecial:
|
||||
specialModule.defineCommonSerializableSpecial,
|
||||
@ -1,6 +1,6 @@
|
||||
// 测试全局 Flag 系统存读档:同实例往返、占用状态与存档克隆
|
||||
import { afterAll, describe, expect, it, vi } from 'vitest';
|
||||
import { FlagSystem } from './system';
|
||||
import { FlagSystem } from '../system';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -28,7 +28,7 @@ vi.hoisted(() => {
|
||||
});
|
||||
|
||||
interface TestModules {
|
||||
FlagSystem: typeof import('./system').FlagSystem;
|
||||
FlagSystem: typeof import('../system').FlagSystem;
|
||||
logger: typeof import('@motajs/common').logger;
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const systemModule = await import('./system');
|
||||
const systemModule = await import('../system');
|
||||
const commonModule = await import('@motajs/common');
|
||||
modules = {
|
||||
FlagSystem: systemModule.FlagSystem,
|
||||
@ -1,7 +1,7 @@
|
||||
// 性能测量:勇士属性修饰器重算随修饰器数量的耗时,只记录不断言
|
||||
import { afterAll, describe, it, vi } from 'vitest';
|
||||
import { BaseHeroModifier, HeroAttribute } from './attribute';
|
||||
import { type IHeroModifier } from './types';
|
||||
import { BaseHeroModifier, HeroAttribute } from '../attribute';
|
||||
import { type IHeroModifier } from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -1,9 +1,9 @@
|
||||
// 测试 HeroAttribute 构件:基础/最终属性、修饰器增删排序、存盘开关、克隆、自身存读档与告警码 108/109、克隆体修饰器簿记与存档开关
|
||||
import { afterAll, describe, expect, it, vi } from 'vitest';
|
||||
import { BaseHeroModifier, HeroAttribute } from './attribute';
|
||||
import { BaseHeroModifier, HeroAttribute } from '../attribute';
|
||||
import { logger } from '@motajs/common';
|
||||
import { SaveCompression } from '@user/data-common';
|
||||
import { type IHeroModifier } from './types';
|
||||
import { type IHeroModifier } from '../types';
|
||||
|
||||
/** 存读档测试覆盖的三档压缩级别 */
|
||||
const SAVE_COMPRESSIONS = [
|
||||
@ -10,13 +10,13 @@ import {
|
||||
TileStore,
|
||||
TileType
|
||||
} from '@user/data-common';
|
||||
import { HeroEquipsStore } from './equipStore';
|
||||
import { PercentageModifier, ValueModifier } from './modifier';
|
||||
import { HeroEquipsStore } from '../equipStore';
|
||||
import { PercentageModifier, ValueModifier } from '../modifier';
|
||||
import {
|
||||
type IEquipmentSortHandler,
|
||||
type IEquipmentSorter,
|
||||
type IEquipmentStateSave
|
||||
} from './types';
|
||||
} from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -12,11 +12,11 @@ import {
|
||||
TileType
|
||||
} from '@user/data-common';
|
||||
import { logger } from '@motajs/common';
|
||||
import { HeroAttribute } from './attribute';
|
||||
import { ValueModifier } from './modifier';
|
||||
import { HeroEquipsStore } from './equipStore';
|
||||
import { HeroEquipment } from './equipment';
|
||||
import { EquipStatus } from './types';
|
||||
import { HeroAttribute } from '../attribute';
|
||||
import { ValueModifier } from '../modifier';
|
||||
import { HeroEquipsStore } from '../equipStore';
|
||||
import { HeroEquipment } from '../equipment';
|
||||
import { EquipStatus } from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -10,10 +10,10 @@ import {
|
||||
TileType
|
||||
} from '@user/data-common';
|
||||
import { logger } from '@motajs/common';
|
||||
import { type IPassPredicate } from '../map';
|
||||
import { HeroFollowersController } from './follower';
|
||||
import { HeroLocation } from './location';
|
||||
import { type IHeroMoveTopImpl } from './types';
|
||||
import { type IPassPredicate } from '../../map';
|
||||
import { HeroFollowersController } from '../follower';
|
||||
import { HeroLocation } from '../location';
|
||||
import { type IHeroMoveTopImpl } from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -9,7 +9,7 @@ import {
|
||||
TileStore,
|
||||
TileType
|
||||
} from '@user/data-common';
|
||||
import { HeroItems } from './items';
|
||||
import { HeroItems } from '../items';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -7,7 +7,7 @@ import {
|
||||
ItemStore,
|
||||
TileStore
|
||||
} from '@user/data-common';
|
||||
import { HeroLocation } from './location';
|
||||
import { HeroLocation } from '../location';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -1,7 +1,7 @@
|
||||
// 测试勇士修饰器构件:数值/百分比公式、默认优先级、类型字符串与绑定重算
|
||||
import { afterAll, describe, expect, it, vi } from 'vitest';
|
||||
import { HeroAttribute } from './attribute';
|
||||
import { PercentageModifier, ValueModifier } from './modifier';
|
||||
import { HeroAttribute } from '../attribute';
|
||||
import { PercentageModifier, ValueModifier } from '../modifier';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -8,9 +8,9 @@ import {
|
||||
TileStore
|
||||
} from '@user/data-common';
|
||||
import { logger } from '@motajs/common';
|
||||
import { type IPassPredicate } from '../map';
|
||||
import { HeroLocation } from './location';
|
||||
import { type IHeroMoveTopHandler, type IHeroMoveTopImpl } from './types';
|
||||
import { type IPassPredicate } from '../../map';
|
||||
import { HeroLocation } from '../location';
|
||||
import { type IHeroMoveTopHandler, type IHeroMoveTopImpl } from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -1,8 +1,8 @@
|
||||
// 测试 HeroRendering 构件:默认不透明度、setAlpha 与 onSetAlpha 钩子注册/解除
|
||||
import { afterAll, describe, expect, it, vi } from 'vitest';
|
||||
import { type IDataCommon, ItemStore, TileStore } from '@user/data-common';
|
||||
import { HeroRendering } from './rendering';
|
||||
import { type IHeroRenderingHooks } from './types';
|
||||
import { HeroRendering } from '../rendering';
|
||||
import { type IHeroRenderingHooks } from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -13,16 +13,16 @@ import {
|
||||
TileType
|
||||
} from '@user/data-common';
|
||||
import { logger } from '@motajs/common';
|
||||
import { HeroAttribute } from './attribute';
|
||||
import { PercentageModifier, ValueModifier } from './modifier';
|
||||
import { HeroLocation } from './location';
|
||||
import { HeroRendering } from './rendering';
|
||||
import { HeroState } from './state';
|
||||
import { HeroEquipment } from './equipment';
|
||||
import { EquipmentState, HeroEquipsStore } from './equipStore';
|
||||
import { HeroItems } from './items';
|
||||
import { HeroFollowersController } from './follower';
|
||||
import { type IHeroState } from './types';
|
||||
import { HeroAttribute } from '../attribute';
|
||||
import { PercentageModifier, ValueModifier } from '../modifier';
|
||||
import { HeroLocation } from '../location';
|
||||
import { HeroRendering } from '../rendering';
|
||||
import { HeroState } from '../state';
|
||||
import { HeroEquipment } from '../equipment';
|
||||
import { EquipmentState, HeroEquipsStore } from '../equipStore';
|
||||
import { HeroItems } from '../items';
|
||||
import { HeroFollowersController } from '../follower';
|
||||
import { type IHeroState } from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -9,10 +9,10 @@ import {
|
||||
TileStore
|
||||
} from '@user/data-common';
|
||||
import { logger } from '@motajs/common';
|
||||
import { HeroAttribute } from './attribute';
|
||||
import { ValueModifier } from './modifier';
|
||||
import { HeroState } from './state';
|
||||
import { type IHeroAttribute, type IHeroState } from './types';
|
||||
import { HeroAttribute } from '../attribute';
|
||||
import { ValueModifier } from '../modifier';
|
||||
import { HeroState } from '../state';
|
||||
import { type IHeroAttribute, type IHeroState } from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -13,9 +13,9 @@ import {
|
||||
TileType
|
||||
} from '@user/data-common';
|
||||
import { DirectionMapper, logger } from '@motajs/common';
|
||||
import { type IResizableMapLayer } from './types';
|
||||
import { MapState } from './mapState';
|
||||
import { DynamicTile } from './dynamicTile';
|
||||
import { type IResizableMapLayer } from '../types';
|
||||
import { MapState } from '../mapState';
|
||||
import { DynamicTile } from '../dynamicTile';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -7,7 +7,7 @@ import {
|
||||
} from '@user/data-common';
|
||||
|
||||
interface TestModules {
|
||||
MapState: typeof import('./mapState').MapState;
|
||||
MapState: typeof import('../mapState').MapState;
|
||||
TileStore: typeof import('@user/data-common').TileStore;
|
||||
RoleFaceBinder: typeof import('@user/data-common').RoleFaceBinder;
|
||||
DirectionMapper: typeof import('@motajs/common').DirectionMapper;
|
||||
@ -29,7 +29,7 @@ beforeAll(async () => {
|
||||
this.set(key, value);
|
||||
return value;
|
||||
};
|
||||
const mapModule = await import('./mapState');
|
||||
const mapModule = await import('../mapState');
|
||||
const commonModule = await import('@user/data-common');
|
||||
const loggerModule = await import('@motajs/common');
|
||||
modules = {
|
||||
@ -1,7 +1,7 @@
|
||||
// 测试 LayerEventView 的参考基准、dirty 状态和恢复行为
|
||||
import { afterAll, describe, expect, it, vi } from 'vitest';
|
||||
import { logger } from '@motajs/common';
|
||||
import { LayerEventView } from './eventView';
|
||||
import { LayerEventView } from '../eventView';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -11,8 +11,8 @@ import {
|
||||
TileType
|
||||
} from '@user/data-common';
|
||||
import { DirectionMapper, logger } from '@motajs/common';
|
||||
import { type IMapLayer } from './types';
|
||||
import { GameMap } from './gameMap';
|
||||
import { type IMapLayer } from '../types';
|
||||
import { GameMap } from '../gameMap';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -18,9 +18,9 @@ import {
|
||||
type IDynamicTile,
|
||||
type IGameMap,
|
||||
type IResizableMapLayer
|
||||
} from './types';
|
||||
import { DynamicTile } from './dynamicTile';
|
||||
import { MapState } from './mapState';
|
||||
} from '../types';
|
||||
import { DynamicTile } from '../dynamicTile';
|
||||
import { MapState } from '../mapState';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -1,6 +1,6 @@
|
||||
// 测试图块默认事件、点事件存读档、压缩聚合和尺寸变化
|
||||
import { beforeAll, describe, expect, it, vi } from 'vitest';
|
||||
import { type IResizableMapLayer } from './types';
|
||||
import { type IResizableMapLayer } from '../types';
|
||||
import {
|
||||
type IDataCommon,
|
||||
type ITileStore,
|
||||
@ -24,7 +24,7 @@ vi.hoisted(() => {
|
||||
});
|
||||
|
||||
interface TestModules {
|
||||
MapState: typeof import('./mapState').MapState;
|
||||
MapState: typeof import('../mapState').MapState;
|
||||
TileStore: typeof import('@user/data-common').TileStore;
|
||||
RoleFaceBinder: typeof import('@user/data-common').RoleFaceBinder;
|
||||
FaceManager: typeof import('@user/data-common').FaceManager;
|
||||
@ -37,7 +37,7 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const mapModule = await import('./mapState');
|
||||
const mapModule = await import('../mapState');
|
||||
const commonModule = await import('@user/data-common');
|
||||
const motaModule = await import('@motajs/common');
|
||||
modules = {
|
||||
@ -12,7 +12,7 @@ import {
|
||||
TileType
|
||||
} from '@user/data-common';
|
||||
import { DirectionMapper, logger } from '@motajs/common';
|
||||
import { MapState } from './mapState';
|
||||
import { MapState } from '../mapState';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -12,10 +12,10 @@ import {
|
||||
TileType
|
||||
} from '@user/data-common';
|
||||
import { DirectionMapper, logger } from '@motajs/common';
|
||||
import { type IResizableMapLayer } from './types';
|
||||
import { MapState } from './mapState';
|
||||
import { DynamicTile } from './dynamicTile';
|
||||
import { DynamicTileMover } from './mover';
|
||||
import { type IResizableMapLayer } from '../types';
|
||||
import { MapState } from '../mapState';
|
||||
import { DynamicTile } from '../dynamicTile';
|
||||
import { DynamicTileMover } from '../mover';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -11,8 +11,8 @@ import {
|
||||
TileType
|
||||
} from '@user/data-common';
|
||||
import { DirectionMapper, logger } from '@motajs/common';
|
||||
import { type IGameMap, type IResizableMapLayer } from './types';
|
||||
import { MapState } from './mapState';
|
||||
import { type IGameMap, type IResizableMapLayer } from '../types';
|
||||
import { MapState } from '../mapState';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -11,9 +11,9 @@ import {
|
||||
TileType
|
||||
} from '@user/data-common';
|
||||
import { DirectionMapper } from '@motajs/common';
|
||||
import { type IResizableMapLayer } from './types';
|
||||
import { MapState } from './mapState';
|
||||
import { StaticTile } from './staticTile';
|
||||
import { type IResizableMapLayer } from '../types';
|
||||
import { MapState } from '../mapState';
|
||||
import { StaticTile } from '../staticTile';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -13,9 +13,9 @@ import {
|
||||
TileType
|
||||
} from '@user/data-common';
|
||||
import { DirectionMapper } from '@motajs/common';
|
||||
import { type IResizableMapLayer } from './types';
|
||||
import { MapState } from './mapState';
|
||||
import { StaticTile } from './staticTile';
|
||||
import { type IResizableMapLayer } from '../types';
|
||||
import { MapState } from '../mapState';
|
||||
import { StaticTile } from '../staticTile';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -1,6 +1,6 @@
|
||||
// 测试 L0 RoleFaceBinder 的朝向分配、绑定与查询(含码 43/44 告警)
|
||||
import { beforeAll, describe, expect, it, vi } from 'vitest';
|
||||
import { FaceDirection } from './types';
|
||||
import { FaceDirection } from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -8,7 +8,7 @@ vi.hoisted(() => {
|
||||
});
|
||||
|
||||
interface TestModules {
|
||||
RoleFaceBinder: typeof import('./face').RoleFaceBinder;
|
||||
RoleFaceBinder: typeof import('../face').RoleFaceBinder;
|
||||
logger: typeof import('@motajs/common').logger;
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const faceModule = await import('./face');
|
||||
const faceModule = await import('../face');
|
||||
const commonModule = await import('@motajs/common');
|
||||
modules = {
|
||||
RoleFaceBinder: faceModule.RoleFaceBinder,
|
||||
@ -1,7 +1,7 @@
|
||||
// 测试 L0 FaceManager 注册表与内建 4/8 方向处理器的方向语义
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { FaceDirection } from './types';
|
||||
import { Dir4FaceHandler, Dir8FaceHandler, FaceManager } from './faceManager';
|
||||
import { FaceDirection } from '../types';
|
||||
import { Dir4FaceHandler, Dir8FaceHandler, FaceManager } from '../faceManager';
|
||||
|
||||
/** 创建内建的 4 方向与 8 方向处理器 */
|
||||
function createHandler() {
|
||||
@ -1,6 +1,6 @@
|
||||
// 测试 L0 MapLocIndexer 的坐标与索引互转及地图宽度切换
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { MapLocIndexer } from './indexer';
|
||||
import { MapLocIndexer } from '../indexer';
|
||||
|
||||
/** 创建索引器并完成地图宽度设置 */
|
||||
function createIndexer(width: number): MapLocIndexer {
|
||||
@ -7,7 +7,7 @@ import {
|
||||
ObjectAnimDirection,
|
||||
type ObjectMoveStep,
|
||||
ObjectMoveType
|
||||
} from './mover';
|
||||
} from '../mover';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -26,7 +26,7 @@ vi.hoisted(() => {
|
||||
});
|
||||
|
||||
interface TestModules {
|
||||
ObjectMover: typeof import('./mover').ObjectMover;
|
||||
ObjectMover: typeof import('../mover').ObjectMover;
|
||||
Dir8FaceHandler: typeof import('@user/data-common').Dir8FaceHandler;
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const moverModule = await import('./mover');
|
||||
const moverModule = await import('../mover');
|
||||
const commonModule = await import('@user/data-common');
|
||||
modules = {
|
||||
ObjectMover: moverModule.ObjectMover,
|
||||
@ -1,12 +1,12 @@
|
||||
// 测试 L0 common 朝向工具纯函数:坐标偏移、降级、旋转与字符串解析
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { FaceDirection } from './types';
|
||||
import { FaceDirection } from '../types';
|
||||
import {
|
||||
degradeFace,
|
||||
fromDirectionString,
|
||||
getFaceMovement,
|
||||
nextFaceDirection
|
||||
} from './utils';
|
||||
} from '../utils';
|
||||
|
||||
/** 全部朝向枚举值,用于校验方向表的完整覆盖 */
|
||||
const ALL_DIRECTIONS: readonly FaceDirection[] = [
|
||||
@ -1,8 +1,8 @@
|
||||
// 测试 ReplayArray 构件级行为:单类型参数编解码与单数组操作单次读回、不可编码参数丢弃后的计数与偏移对齐、乘数恰为 1 的边界
|
||||
import { logger } from '@motajs/common';
|
||||
import { afterAll, describe, expect, it, vi } from 'vitest';
|
||||
import { ReplayArray } from './array';
|
||||
import { ReplayCommandWidth, ReplayParamValue } from './types';
|
||||
import { ReplayArray } from '../array';
|
||||
import { ReplayCommandWidth, ReplayParamValue } from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -7,8 +7,8 @@ import {
|
||||
ignoreReplay,
|
||||
logReplaySafetyDetail,
|
||||
shouldReplay
|
||||
} from './func';
|
||||
import { ReplaySystem } from './system';
|
||||
} from '../func';
|
||||
import { ReplaySystem } from '../system';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -1,8 +1,8 @@
|
||||
// 测试 ReplaySandbox 播放器的步进、收尾与播放控制
|
||||
import { logger } from '@motajs/common';
|
||||
import { afterAll, afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import { ReplaySystem } from './system';
|
||||
import { IReplayCommand, IReplaySandbox, IReplayStepHandler } from './types';
|
||||
import { ReplaySystem } from '../system';
|
||||
import { IReplayCommand, IReplaySandbox, IReplayStepHandler } from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -1,7 +1,7 @@
|
||||
// 测试录像存读档:ReplaySystem 同实例往返、多类型参数读回与活跃读流跨读档过期
|
||||
import { logger } from '@motajs/common';
|
||||
import { afterAll, describe, expect, it, vi } from 'vitest';
|
||||
import { ReplaySystem } from './system';
|
||||
import { ReplaySystem } from '../system';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -1,13 +1,13 @@
|
||||
// 测试 ReplaySystem 的指令注册、录像录制与沙箱生命周期
|
||||
import { logger } from '@motajs/common';
|
||||
import { afterAll, describe, expect, it, vi } from 'vitest';
|
||||
import { ReplaySystem } from './system';
|
||||
import { ReplaySystem } from '../system';
|
||||
import {
|
||||
IReplayCommand,
|
||||
IReplaySandbox,
|
||||
ReplayCommandWidth,
|
||||
ReplayParamValue
|
||||
} from './types';
|
||||
} from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { TileStore } from './tileStore';
|
||||
import { ITileRawData, TileType } from './types';
|
||||
import { TileStore } from '../tileStore';
|
||||
import { ITileRawData, TileType } from '../types';
|
||||
|
||||
function createTile(
|
||||
num: number,
|
||||
@ -2,7 +2,7 @@
|
||||
import { beforeAll, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
interface TestModules {
|
||||
CoreState: typeof import('./core').CoreState;
|
||||
CoreState: typeof import('../core').CoreState;
|
||||
}
|
||||
|
||||
interface FakeLayer {
|
||||
@ -44,7 +44,7 @@ interface CoreInitializer {
|
||||
initMapState(floors: string[], data: Record<string, LegacyFloor>): void;
|
||||
}
|
||||
|
||||
vi.mock('./enemy', () => ({
|
||||
vi.mock('../enemy', () => ({
|
||||
CommonAuraConverter: class {},
|
||||
EnemyLegacyBridge: class {},
|
||||
GuardAuraConverter: class {},
|
||||
@ -56,7 +56,7 @@ vi.mock('./enemy', () => ({
|
||||
registerSpecials: vi.fn()
|
||||
}));
|
||||
|
||||
vi.mock('./legacy', () => ({
|
||||
vi.mock('../legacy', () => ({
|
||||
ItemLegacyBridge: class {},
|
||||
TileLegacyBridge: class {}
|
||||
}));
|
||||
@ -66,7 +66,7 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const coreModule = await import('./core');
|
||||
const coreModule = await import('../core');
|
||||
modules = { CoreState: coreModule.CoreState };
|
||||
});
|
||||
|
||||
@ -13,7 +13,7 @@ import {
|
||||
type IReadonlyEnemy,
|
||||
type ISpecial
|
||||
} from '@user/data-base';
|
||||
import { type IHaloValue } from './special';
|
||||
import { type IHaloValue } from '../special';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -42,10 +42,10 @@ vi.hoisted(() => {
|
||||
});
|
||||
|
||||
interface TestModules {
|
||||
CommonAura: typeof import('./aura').CommonAura;
|
||||
CommonAuraConverter: typeof import('./aura').CommonAuraConverter;
|
||||
GuardAura: typeof import('./aura').GuardAura;
|
||||
GuardAuraConverter: typeof import('./aura').GuardAuraConverter;
|
||||
CommonAura: typeof import('../aura').CommonAura;
|
||||
CommonAuraConverter: typeof import('../aura').CommonAuraConverter;
|
||||
GuardAura: typeof import('../aura').GuardAura;
|
||||
GuardAuraConverter: typeof import('../aura').GuardAuraConverter;
|
||||
FullRange: typeof import('@motajs/common').FullRange;
|
||||
RectRange: typeof import('@motajs/common').RectRange;
|
||||
ManhattanRange: typeof import('@motajs/common').ManhattanRange;
|
||||
@ -56,7 +56,7 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const auraModule = await import('./aura');
|
||||
const auraModule = await import('../aura');
|
||||
const motaModule = await import('@motajs/common');
|
||||
modules = {
|
||||
CommonAura: auraModule.CommonAura,
|
||||
@ -41,7 +41,7 @@ vi.hoisted(() => {
|
||||
});
|
||||
|
||||
interface TestModules {
|
||||
MainDamageCalculator: typeof import('./calculator').MainDamageCalculator;
|
||||
MainDamageCalculator: typeof import('../calculator').MainDamageCalculator;
|
||||
logger: typeof import('@motajs/common').logger;
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const calculatorModule = await import('./calculator');
|
||||
const calculatorModule = await import('../calculator');
|
||||
const motaModule = await import('@motajs/common');
|
||||
modules = {
|
||||
MainDamageCalculator: calculatorModule.MainDamageCalculator,
|
||||
@ -30,7 +30,7 @@ vi.hoisted(() => {
|
||||
});
|
||||
|
||||
interface TestModules {
|
||||
MainEnemyComparer: typeof import('./comparer').MainEnemyComparer;
|
||||
MainEnemyComparer: typeof import('../comparer').MainEnemyComparer;
|
||||
}
|
||||
|
||||
let modules: TestModules;
|
||||
@ -38,7 +38,7 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const comparerModule = await import('./comparer');
|
||||
const comparerModule = await import('../comparer');
|
||||
modules = {
|
||||
MainEnemyComparer: comparerModule.MainEnemyComparer
|
||||
};
|
||||
@ -31,7 +31,7 @@ vi.hoisted(() => {
|
||||
});
|
||||
|
||||
interface TestModules {
|
||||
MainEnemyFinalEffect: typeof import('./final').MainEnemyFinalEffect;
|
||||
MainEnemyFinalEffect: typeof import('../final').MainEnemyFinalEffect;
|
||||
}
|
||||
|
||||
let modules: TestModules;
|
||||
@ -39,7 +39,7 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const finalModule = await import('./final');
|
||||
const finalModule = await import('../final');
|
||||
modules = {
|
||||
MainEnemyFinalEffect: finalModule.MainEnemyFinalEffect
|
||||
};
|
||||
@ -13,7 +13,7 @@ import {
|
||||
type IReadonlyHeroAttribute,
|
||||
type ISpecial
|
||||
} from '@user/data-base';
|
||||
import { type IZoneValue } from './special';
|
||||
import { type IZoneValue } from '../special';
|
||||
|
||||
const testGlobals = vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -45,14 +45,14 @@ const testGlobals = vi.hoisted(() => {
|
||||
});
|
||||
|
||||
interface TestModules {
|
||||
ZoneDamageView: typeof import('./mapDamage').ZoneDamageView;
|
||||
RepulseDamageView: typeof import('./mapDamage').RepulseDamageView;
|
||||
LaserDamageView: typeof import('./mapDamage').LaserDamageView;
|
||||
BetweenDamageView: typeof import('./mapDamage').BetweenDamageView;
|
||||
AmbushDamageView: typeof import('./mapDamage').AmbushDamageView;
|
||||
MainMapDamageConverter: typeof import('./mapDamage').MainMapDamageConverter;
|
||||
MainMapDamageReducer: typeof import('./mapDamage').MainMapDamageReducer;
|
||||
MapDamageType: typeof import('./types').MapDamageType;
|
||||
ZoneDamageView: typeof import('../mapDamage').ZoneDamageView;
|
||||
RepulseDamageView: typeof import('../mapDamage').RepulseDamageView;
|
||||
LaserDamageView: typeof import('../mapDamage').LaserDamageView;
|
||||
BetweenDamageView: typeof import('../mapDamage').BetweenDamageView;
|
||||
AmbushDamageView: typeof import('../mapDamage').AmbushDamageView;
|
||||
MainMapDamageConverter: typeof import('../mapDamage').MainMapDamageConverter;
|
||||
MainMapDamageReducer: typeof import('../mapDamage').MainMapDamageReducer;
|
||||
MapDamageType: typeof import('../types').MapDamageType;
|
||||
ManhattanRange: typeof import('@motajs/common').ManhattanRange;
|
||||
RectRange: typeof import('@motajs/common').RectRange;
|
||||
FaceGroup: typeof import('@user/data-common').FaceGroup;
|
||||
@ -63,8 +63,8 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const mapDamageModule = await import('./mapDamage');
|
||||
const typesModule = await import('./types');
|
||||
const mapDamageModule = await import('../mapDamage');
|
||||
const typesModule = await import('../types');
|
||||
const motaModule = await import('@motajs/common');
|
||||
const commonModule = await import('@user/data-common');
|
||||
modules = {
|
||||
@ -1,7 +1,7 @@
|
||||
// 测试怪物特殊属性注册:代码 0-27 全量注册、守卫默认值、名称与描述生成
|
||||
import { beforeAll, describe, expect, it, vi } from 'vitest';
|
||||
import { type ISpecial } from '@user/data-base';
|
||||
import { type IHaloValue } from './special';
|
||||
import { type IHaloValue } from '../special';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -30,7 +30,7 @@ vi.hoisted(() => {
|
||||
});
|
||||
|
||||
interface TestModules {
|
||||
registerSpecials: typeof import('./special').registerSpecials;
|
||||
registerSpecials: typeof import('../special').registerSpecials;
|
||||
}
|
||||
|
||||
let modules: TestModules;
|
||||
@ -38,7 +38,7 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const specialModule = await import('./special');
|
||||
const specialModule = await import('../special');
|
||||
modules = { registerSpecials: specialModule.registerSpecials };
|
||||
});
|
||||
|
||||
@ -9,7 +9,7 @@ import {
|
||||
TileType
|
||||
} from '@user/data-common';
|
||||
import { BlockEventType, IBlockEventEnv } from '@user/data-system';
|
||||
import { CoreState } from '../core';
|
||||
import { CoreState } from '../../core';
|
||||
import {
|
||||
createEventRegistrations,
|
||||
EventRemoveBlock,
|
||||
@ -19,10 +19,10 @@ import {
|
||||
EventMoveHero,
|
||||
EventStepHero,
|
||||
EventSetBlock
|
||||
} from './index';
|
||||
import { EventSetBlock as MapEventSetBlock } from './map';
|
||||
import { EventInsertEvent as ControlEventInsertEvent } from './event';
|
||||
import * as dataStateRoot from '../index';
|
||||
} from '../index';
|
||||
import { EventSetBlock as MapEventSetBlock } from '../map';
|
||||
import { EventInsertEvent as ControlEventInsertEvent } from '../event';
|
||||
import * as dataStateRoot from '../../index';
|
||||
|
||||
interface EventFixture {
|
||||
readonly state: CoreState;
|
||||
@ -317,11 +317,11 @@ describe('event registration ownership', () => {
|
||||
// 验证事件 barrel 仅含导出语句且既有公开事件符号仍可从根索引导入
|
||||
it('keeps both barrels export-only and preserves public event symbols', () => {
|
||||
const eventBarrel = readFileSync(
|
||||
new URL('./index.ts', import.meta.url),
|
||||
new URL('../index.ts', import.meta.url),
|
||||
'utf8'
|
||||
);
|
||||
const rootBarrel = readFileSync(
|
||||
new URL('../index.ts', import.meta.url),
|
||||
new URL('../../index.ts', import.meta.url),
|
||||
'utf8'
|
||||
);
|
||||
expect(eventBarrel).not.toMatch(/^\s*import\s/m);
|
||||
@ -12,15 +12,15 @@ import {
|
||||
} from '@user/data-common';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { createCoreState } from '../core';
|
||||
import { ReplaySystem } from '../../../data-common/src/replay/system';
|
||||
import { createCoreState } from '../../core';
|
||||
import { ReplaySystem } from '../../../../data-common/src/replay/system';
|
||||
import {
|
||||
ReplayEquip,
|
||||
ReplayMove,
|
||||
ReplayTeleport,
|
||||
ReplayUnequip,
|
||||
ReplayUseItem
|
||||
} from './commands';
|
||||
} from '../commands';
|
||||
|
||||
/** 供测试读取的稳定指令码顺序 */
|
||||
export const REPLAY_COMMAND_ORDER: readonly ReplayCode[] = [
|
||||
@ -332,7 +332,7 @@ describe('replay commands', () => {
|
||||
// 验证注册直接写在 CoreState 内,且指令模块自包含、不含 replay safety
|
||||
it('keeps registration direct and the command module self-contained', () => {
|
||||
const commands = readFileSync(
|
||||
new URL('./commands.ts', import.meta.url),
|
||||
new URL('../commands.ts', import.meta.url),
|
||||
'utf8'
|
||||
);
|
||||
expect(commands).not.toContain('createReplayCommandItems');
|
||||
@ -343,7 +343,7 @@ describe('replay commands', () => {
|
||||
expect(commands).not.toContain('shouldReplay');
|
||||
|
||||
const core = readFileSync(
|
||||
new URL('../core.ts', import.meta.url),
|
||||
new URL('../../core.ts', import.meta.url),
|
||||
'utf8'
|
||||
);
|
||||
expect(core).not.toContain('createReplayCommandItems');
|
||||
@ -430,7 +430,7 @@ describe('replay safety decorators', () => {
|
||||
it('does not change user-owned attribute decorator placement', () => {
|
||||
const source = readFileSync(
|
||||
new URL(
|
||||
'../../../data-base/src/hero/attribute.ts',
|
||||
'../../../../data-base/src/hero/attribute.ts',
|
||||
import.meta.url
|
||||
),
|
||||
'utf8'
|
||||
@ -12,7 +12,7 @@ import {
|
||||
type IEnemyContext,
|
||||
type IEnemyDamageInfo,
|
||||
type IEnemyView
|
||||
} from './types';
|
||||
} from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -59,7 +59,7 @@ interface TestHeroAttr {
|
||||
}
|
||||
|
||||
interface TestModules {
|
||||
CombatFlow: typeof import('./combat').CombatFlow;
|
||||
CombatFlow: typeof import('../combat').CombatFlow;
|
||||
Enemy: typeof import('@user/data-base').Enemy;
|
||||
HeroAttribute: typeof import('@user/data-base').HeroAttribute;
|
||||
logger: typeof import('@motajs/common').logger;
|
||||
@ -70,7 +70,7 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const combatModule = await import('./combat');
|
||||
const combatModule = await import('../combat');
|
||||
const baseModule = await import('@user/data-base');
|
||||
const motaModule = await import('@motajs/common');
|
||||
modules = {
|
||||
@ -139,7 +139,7 @@ class FakeScript implements ICombatScript<TestEnemyAttr, TestHeroAttr> {
|
||||
}
|
||||
}
|
||||
|
||||
type TestCombatFlow = import('./combat').CombatFlow<
|
||||
type TestCombatFlow = import('../combat').CombatFlow<
|
||||
TestEnemyAttr,
|
||||
TestHeroAttr
|
||||
>;
|
||||
@ -8,7 +8,7 @@ import {
|
||||
type IEnemyAuraView,
|
||||
type IEnemyHandler,
|
||||
type IEnemySpecialModifier
|
||||
} from './types';
|
||||
} from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -55,7 +55,7 @@ interface TestHeroAttr {
|
||||
}
|
||||
|
||||
interface TestModules {
|
||||
EnemyContext: typeof import('./context').EnemyContext;
|
||||
EnemyContext: typeof import('../context').EnemyContext;
|
||||
Enemy: typeof import('@user/data-base').Enemy;
|
||||
HeroAttribute: typeof import('@user/data-base').HeroAttribute;
|
||||
FullRange: typeof import('@motajs/common').FullRange;
|
||||
@ -66,7 +66,7 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const contextModule = await import('./context');
|
||||
const contextModule = await import('../context');
|
||||
const baseModule = await import('@user/data-base');
|
||||
const motaModule = await import('@motajs/common');
|
||||
modules = {
|
||||
@ -223,7 +223,7 @@ class PerfConverter implements IAuraConverter<TestEnemyAttr, TestHeroAttr> {
|
||||
}
|
||||
}
|
||||
|
||||
type TestEnemyContext = import('./context').EnemyContext<
|
||||
type TestEnemyContext = import('../context').EnemyContext<
|
||||
TestEnemyAttr,
|
||||
TestHeroAttr
|
||||
>;
|
||||
@ -18,7 +18,7 @@ import {
|
||||
type IEnemySpecialModifier,
|
||||
type IEnemySpecialQueryEffect,
|
||||
type IEnemyView
|
||||
} from './types';
|
||||
} from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -65,7 +65,7 @@ interface TestHeroAttr {
|
||||
}
|
||||
|
||||
interface TestModules {
|
||||
EnemyContext: typeof import('./context').EnemyContext;
|
||||
EnemyContext: typeof import('../context').EnemyContext;
|
||||
Enemy: typeof import('@user/data-base').Enemy;
|
||||
HeroAttribute: typeof import('@user/data-base').HeroAttribute;
|
||||
RectRange: typeof import('@motajs/common').RectRange;
|
||||
@ -79,7 +79,7 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const contextModule = await import('./context');
|
||||
const contextModule = await import('../context');
|
||||
const baseModule = await import('@user/data-base');
|
||||
const motaModule = await import('@motajs/common');
|
||||
modules = {
|
||||
@ -128,7 +128,7 @@ function createEnemy(
|
||||
});
|
||||
}
|
||||
|
||||
type TestEnemyContext = import('./context').EnemyContext<
|
||||
type TestEnemyContext = import('../context').EnemyContext<
|
||||
TestEnemyAttr,
|
||||
TestHeroAttr
|
||||
>;
|
||||
@ -9,7 +9,7 @@ import {
|
||||
type IEnemyDamageInfoBase,
|
||||
type IEnemyView,
|
||||
type IReadonlyEnemyHandler
|
||||
} from './types';
|
||||
} from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -56,7 +56,7 @@ interface TestHeroAttr {
|
||||
}
|
||||
|
||||
interface TestModules {
|
||||
DamageContext: typeof import('./damage').DamageContext;
|
||||
DamageContext: typeof import('../damage').DamageContext;
|
||||
HeroAttribute: typeof import('@user/data-base').HeroAttribute;
|
||||
Enemy: typeof import('@user/data-base').Enemy;
|
||||
MapLocIndexer: typeof import('@user/data-common').MapLocIndexer;
|
||||
@ -67,7 +67,7 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const damageModule = await import('./damage');
|
||||
const damageModule = await import('../damage');
|
||||
const baseModule = await import('@user/data-base');
|
||||
const commonModule = await import('@user/data-common');
|
||||
modules = {
|
||||
@ -13,7 +13,7 @@ import {
|
||||
type IEnemyDamageInfoBase,
|
||||
type IEnemyView,
|
||||
type IReadonlyEnemyHandler
|
||||
} from './types';
|
||||
} from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -60,9 +60,9 @@ interface TestHeroAttr {
|
||||
}
|
||||
|
||||
interface TestModules {
|
||||
DamageContext: typeof import('./damage').DamageContext;
|
||||
DamageSystem: typeof import('./damage').DamageSystem;
|
||||
EnemyContext: typeof import('./context').EnemyContext;
|
||||
DamageContext: typeof import('../damage').DamageContext;
|
||||
DamageSystem: typeof import('../damage').DamageSystem;
|
||||
EnemyContext: typeof import('../context').EnemyContext;
|
||||
HeroAttribute: typeof import('@user/data-base').HeroAttribute;
|
||||
Enemy: typeof import('@user/data-base').Enemy;
|
||||
MapLocIndexer: typeof import('@user/data-common').MapLocIndexer;
|
||||
@ -75,8 +75,8 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const damageModule = await import('./damage');
|
||||
const contextModule = await import('./context');
|
||||
const damageModule = await import('../damage');
|
||||
const contextModule = await import('../context');
|
||||
const baseModule = await import('@user/data-base');
|
||||
const commonModule = await import('@user/data-common');
|
||||
const motaModule = await import('@motajs/common');
|
||||
@ -125,7 +125,7 @@ class FakeCalculator implements IDamageCalculator<TestEnemyAttr, TestHeroAttr> {
|
||||
}
|
||||
|
||||
type TestHeroAttribute = import('@user/data-base').HeroAttribute<TestHeroAttr>;
|
||||
type TestEnemyContext = import('./context').EnemyContext<
|
||||
type TestEnemyContext = import('../context').EnemyContext<
|
||||
TestEnemyAttr,
|
||||
TestHeroAttr
|
||||
>;
|
||||
@ -14,7 +14,7 @@ import {
|
||||
type IMapDamageInfo,
|
||||
type IMapDamageReducer,
|
||||
type IMapDamageView
|
||||
} from './types';
|
||||
} from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -61,7 +61,7 @@ interface TestHeroAttr {
|
||||
}
|
||||
|
||||
interface TestModules {
|
||||
MapDamage: typeof import('./mapDamage').MapDamage;
|
||||
MapDamage: typeof import('../mapDamage').MapDamage;
|
||||
MapLocIndexer: typeof import('@user/data-common').MapLocIndexer;
|
||||
HeroAttribute: typeof import('@user/data-base').HeroAttribute;
|
||||
Enemy: typeof import('@user/data-base').Enemy;
|
||||
@ -73,7 +73,7 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const mapDamageModule = await import('./mapDamage');
|
||||
const mapDamageModule = await import('../mapDamage');
|
||||
const commonModule = await import('@user/data-common');
|
||||
const motaModule = await import('@motajs/common');
|
||||
const baseModule = await import('@user/data-base');
|
||||
@ -7,14 +7,14 @@ import {
|
||||
type ITileStore,
|
||||
EventTrigger
|
||||
} from '@user/data-common';
|
||||
import { type IStateSystem } from '../types';
|
||||
import { type IStateSystem } from '../../types';
|
||||
import {
|
||||
EventExecuteMode,
|
||||
EventReduceMode,
|
||||
BlockEventType,
|
||||
type IBlockEventEnv,
|
||||
type IGameEventInvocation
|
||||
} from './types';
|
||||
} from '../types';
|
||||
import { AnonTokyoInterpreter } from '@motajs/anon-tokyo';
|
||||
import { IStateBase } from '@user/data-base';
|
||||
|
||||
@ -58,8 +58,8 @@ const eventReduceModes = {
|
||||
} as const;
|
||||
|
||||
interface TestModules {
|
||||
EventExecutor: typeof import('./executor').EventExecutor;
|
||||
GameEventSystem: typeof import('./system').GameEventSystem;
|
||||
EventExecutor: typeof import('../executor').EventExecutor;
|
||||
GameEventSystem: typeof import('../system').GameEventSystem;
|
||||
DefaultHeroMoveTopImpl: typeof import('@user/data-state').DefaultHeroMoveTopImpl;
|
||||
MapState: typeof import('@user/data-base').MapState;
|
||||
TileStore: typeof import('@user/data-common').TileStore;
|
||||
@ -87,9 +87,9 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const executorModule = await import('./executor');
|
||||
const systemModule = await import('./system');
|
||||
const stateModule = await import('../../../data-state/src/hero');
|
||||
const executorModule = await import('../executor');
|
||||
const systemModule = await import('../system');
|
||||
const stateModule = await import('../../../../data-state/src/hero');
|
||||
const baseModule = await import('@user/data-base');
|
||||
const commonModule = await import('@user/data-common');
|
||||
modules = {
|
||||
@ -30,7 +30,7 @@ vi.hoisted(() => {
|
||||
});
|
||||
|
||||
interface TestModules {
|
||||
PathfindingGraphBuilder: typeof import('./graph').MapGraphBuilder;
|
||||
PathfindingGraphBuilder: typeof import('../graph').MapGraphBuilder;
|
||||
MapState: typeof import('@user/data-base').MapState;
|
||||
TileStore: typeof import('@user/data-common').TileStore;
|
||||
FaceManager: typeof import('@user/data-common').FaceManager;
|
||||
@ -45,7 +45,7 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const graphModule = await import('./graph');
|
||||
const graphModule = await import('../graph');
|
||||
const baseModule = await import('@user/data-base');
|
||||
const commonModule = await import('@user/data-common');
|
||||
const motaModule = await import('@motajs/common');
|
||||
@ -14,8 +14,8 @@ import {
|
||||
type IPassCheckHandler,
|
||||
type IPassPredicate
|
||||
} from '@user/data-base';
|
||||
import { MapGraphBuilder } from './graph';
|
||||
import { type PathfindingSystem } from './system';
|
||||
import { MapGraphBuilder } from '../graph';
|
||||
import { type PathfindingSystem } from '../system';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -34,7 +34,7 @@ vi.hoisted(() => {
|
||||
});
|
||||
|
||||
interface TestModules {
|
||||
PathfindingSystem: typeof import('./system').PathfindingSystem;
|
||||
PathfindingSystem: typeof import('../system').PathfindingSystem;
|
||||
MapState: typeof import('@user/data-base').MapState;
|
||||
TileStore: typeof import('@user/data-common').TileStore;
|
||||
ObjectMover: typeof import('@user/data-common').ObjectMover;
|
||||
@ -49,7 +49,7 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const systemModule = await import('./system');
|
||||
const systemModule = await import('../system');
|
||||
const baseModule = await import('@user/data-base');
|
||||
const commonModule = await import('@user/data-common');
|
||||
const motaModule = await import('@motajs/common');
|
||||
@ -17,8 +17,8 @@ import {
|
||||
type IPassCheckHandler,
|
||||
type IPassPredicate
|
||||
} from '@user/data-base';
|
||||
import { type PathfindingSystem } from './system';
|
||||
import { type IPathfindingStep, type PathCostFunction } from './types';
|
||||
import { type PathfindingSystem } from '../system';
|
||||
import { type IPathfindingStep, type PathCostFunction } from '../types';
|
||||
|
||||
vi.hoisted(() => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
@ -37,7 +37,7 @@ vi.hoisted(() => {
|
||||
});
|
||||
|
||||
interface TestModules {
|
||||
PathfindingSystem: typeof import('./system').PathfindingSystem;
|
||||
PathfindingSystem: typeof import('../system').PathfindingSystem;
|
||||
MapState: typeof import('@user/data-base').MapState;
|
||||
TileStore: typeof import('@user/data-common').TileStore;
|
||||
ObjectMover: typeof import('@user/data-common').ObjectMover;
|
||||
@ -53,7 +53,7 @@ let modules: TestModules;
|
||||
beforeAll(async () => {
|
||||
vi.stubGlobal('main', { replayChecking: true });
|
||||
vi.stubGlobal('location', { origin: 'http://localhost' });
|
||||
const systemModule = await import('./system');
|
||||
const systemModule = await import('../system');
|
||||
const baseModule = await import('@user/data-base');
|
||||
const commonModule = await import('@user/data-common');
|
||||
const motaModule = await import('@motajs/common');
|
||||
@ -64,7 +64,7 @@ interface IManualReplaySandbox extends IReplaySandbox {
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const verifierModule =
|
||||
require('../packages-user/data-state/test/replayVerifier.ts') as IVerifierModule;
|
||||
require('../packages-user/data-state/__test__/replayVerifier.ts') as IVerifierModule;
|
||||
|
||||
function captureMaps(
|
||||
state: CoreState
|
||||
@ -119,7 +119,7 @@ function createRuntime(fixture: IClosedLoopFixture): IReplayVerifierRuntime {
|
||||
|
||||
export async function runNodeReplayVerifier(): Promise<void> {
|
||||
const closedLoopModule =
|
||||
require('../packages-user/data-state/test/fixtures/closed-loop.ts') as IClosedLoopModule;
|
||||
require('../packages-user/data-state/__test__/fixtures/closed-loop.ts') as IClosedLoopModule;
|
||||
const fixture = closedLoopModule.createClosedLoopFixture();
|
||||
await verifierModule.verifyReplay(createRuntime(fixture));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user