Files
Find-Word/tests/generator.test.ts
2026-10-14 10:01:46 +00:00

31 lines
1.2 KiB
TypeScript

// @vitest-environment node
import { spawnSync } from "node:child_process";
import { expect, it } from "vitest";
// Python 경계 테스트도 npm test에 포함한다. provider 호출은 fake이며 ffmpeg
// 변환과 Linux 원자 디렉터리 교체는 실제로 실행한다. 외부 네트워크는 쓰지 않는다.
it("neural 생성기의 실패 보존·retry·PCM·비밀값 부재 계약", () => {
const result = spawnSync(
"python3",
["-m", "unittest", "discover", "-s", "tests/python", "-v"],
{ encoding: "utf8" },
);
expect(result.status, result.stdout + result.stderr).toBe(0);
}, 60_000);
// 콘텐츠에 URL 모듈이 추가되어도 Python 생성기가 사용하는 Node 직접 import가 유지돼야 한다.
it("Node type stripping 경로에서 기존 101문장 원문을 읽을 수 있다", () => {
const result = spawnSync(
"node",
[
"--experimental-strip-types",
"--input-type=module",
"-e",
"import {INTRO,PATTERNS,WORDS} from './src/content.ts'; console.log(INTRO && PATTERNS.length * WORDS.length + 1)",
],
{ encoding: "utf8" },
);
expect(result.status, result.stderr).toBe(0);
expect(result.stdout.trim()).toBe("101");
});