30 lines
1.4 KiB
TypeScript
30 lines
1.4 KiB
TypeScript
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { execFile } from "node:child_process";
|
|
import { promisify } from "node:util";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const exec = promisify(execFile);
|
|
const CLI = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../dist/index.js");
|
|
|
|
test("tools 는 --yes 없이 아무것도 설치하지 않는다", async () => {
|
|
// 수백 MB 를 받는 명령이라 조용히 시작하면 안 된다.
|
|
// 상태만 보이거나, 이미 다 있으면 그렇다고 말해야 한다.
|
|
const { stdout } = await exec(process.execPath, [CLI, "tools", "--no-update-check"]);
|
|
assert.match(stdout, /브라우저 도구/);
|
|
assert.match(stdout, /모션·미디어 도구/);
|
|
assert.doesNotMatch(stdout, /설치 중/);
|
|
});
|
|
|
|
test("도움말에 tools 명령이 나온다", async () => {
|
|
const { stdout } = await exec(process.execPath, [CLI, "--help"]);
|
|
assert.match(stdout, /designpaca tools/);
|
|
});
|
|
|
|
test("사용자에게 보이는 문구가 명령조가 아니다", async () => {
|
|
// 스킬 문서는 단정한 반말이 의도지만, 사용자를 향한 CLI 문구는 다르다.
|
|
const { stdout } = await exec(process.execPath, [CLI, "--help"]);
|
|
const rude = /(해라|써라|봐라|던져라|가라)/;
|
|
assert.doesNotMatch(stdout, rude, "도움말에 명령조 표현이 남아 있다");
|
|
});
|