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:
AncTe committed 2026-10-04 17:34:09 +08:00
1 parent 109fad3b29
commit 36d8b4fb3c
75 files changed
+201 -201

No files matched your search

@@ -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');