mirror of
https://github.com/motajs/template.git
synced 2026-11-18 18:24:30 +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:
1 parent
109fad3b29
commit
36d8b4fb3c
75 files changed
+201
-201
No files matched your search
+3
-3
@@ -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,
|
||||
+2
-2
@@ -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
-1
@@ -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 {
|
||||
+3
-3
@@ -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,
|
||||
+2
-2
@@ -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[] = [
|
||||
+2
-2
@@ -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 });
|
||||
+2
-2
@@ -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 });
|
||||
+2
-2
@@ -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
-1
@@ -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 });
|
||||
+2
-2
@@ -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 });
|
||||
File renamed without changes.
+2
-2
@@ -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,
|
||||
Reference in new issue
Block a user