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

@@ -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,