-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcli.test.ts
More file actions
48 lines (41 loc) · 1.56 KB
/
Copy pathcli.test.ts
File metadata and controls
48 lines (41 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { mkdtempSync, mkdirSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { renderValidation, validatePaths } from "../src/cli.js";
const SPORTS_MOVE = `posecode exercise "Jump shot"
rig humanoid
pose start = standing
step "Gather" 0.4s settle:
knees: flex 70
ground-lock: feet
step "Explode" 0.3s drive:
knees: flex 10
ankles: plantarflex 26
travel: 0 0.12
ground-lock: feet
step "Release" 0.2s snap:
shoulders: flex 160
wrists: flex 34
repeat 1
`;
describe("posecode validator", () => {
it("recursively validates third-party movement libraries using timing modes", () => {
const root = mkdtempSync(join(tmpdir(), "posecode-validator-"));
const nested = join(root, "basketball");
mkdirSync(nested);
writeFileSync(join(nested, "jump-shot.posecode"), SPORTS_MOVE);
const summary = validatePaths([root]);
expect(summary).toMatchObject({ fileCount: 1, errorCount: 0, warningCount: 0 });
});
it("prints file and line diagnostics for invalid timing modes", () => {
const root = mkdtempSync(join(tmpdir(), "posecode-validator-"));
const file = join(root, "broken.posecode");
writeFileSync(file, SPORTS_MOVE.replace("0.3s drive", "0.3s turbo"));
const summary = validatePaths([file]);
const output = renderValidation(summary);
expect(summary.errorCount).toBe(1);
expect(output).toContain(`${file}:7: error:`);
expect(output).toContain('unknown timing mode "turbo"');
});
});