77 lines
2.0 KiB
JavaScript
77 lines
2.0 KiB
JavaScript
const assert = require("node:assert/strict");
|
|
const path = require("node:path");
|
|
const { test } = require("node:test");
|
|
const {
|
|
validateSource,
|
|
checkWorkspace,
|
|
} = require("../scripts/check-module-boundaries.cjs");
|
|
|
|
test("현재 신규 feature·transport·legacy bridge가 구조 정책을 통과", () => {
|
|
const result = checkWorkspace(path.resolve(__dirname, ".."));
|
|
assert.ok(result.checkedFiles >= 20);
|
|
assert.deepEqual(result.errors, []);
|
|
});
|
|
|
|
test("model의 app·API 의존은 type-only여도 실패", () => {
|
|
assert.ok(
|
|
validateSource(
|
|
"src/features/dredging/model/new.ts",
|
|
'import type { X } from "@/app/route";',
|
|
).length,
|
|
);
|
|
assert.ok(
|
|
validateSource(
|
|
"src/features/dredging/model/new.ts",
|
|
'import type { X } from "../api/client";',
|
|
).length,
|
|
);
|
|
});
|
|
|
|
test("명시한 legacy helper만 기존 adapter에서 허용", () => {
|
|
assert.deepEqual(
|
|
validateSource(
|
|
"src/features/dredging/api/dredging-api.ts",
|
|
'import { getData } from "@/components/lib/api";',
|
|
),
|
|
[],
|
|
);
|
|
assert.ok(
|
|
validateSource(
|
|
"src/features/dredging/lib/new.ts",
|
|
'import { getData } from "@/components/lib/api";',
|
|
).length,
|
|
);
|
|
assert.ok(
|
|
validateSource(
|
|
"src/features/dredging/api/dredging-api.ts",
|
|
'import { X } from "@/components/ui/new";',
|
|
).length,
|
|
);
|
|
});
|
|
|
|
test("legacy 진입점에 구현을 다시 추가하면 실패", () => {
|
|
const file = "app/(with-base-layout)/oper/dredging/lib/date.ts";
|
|
assert.deepEqual(
|
|
validateSource(file, 'export * from "@/features/dredging/lib/date";'),
|
|
[],
|
|
);
|
|
assert.ok(
|
|
validateSource(file, "export const formatDate = () => null;").length,
|
|
);
|
|
});
|
|
|
|
test("transport 상위 계층 의존과 동적 app import도 실패", () => {
|
|
assert.ok(
|
|
validateSource(
|
|
"src/shared/api/http-transport.ts",
|
|
'import { token } from "@/entities/auth";',
|
|
).length,
|
|
);
|
|
assert.ok(
|
|
validateSource(
|
|
"src/features/mapLayers/lib/new.ts",
|
|
'const route = import("@/app/map");',
|
|
).length,
|
|
);
|
|
});
|