66 lines
1.9 KiB
TypeScript
66 lines
1.9 KiB
TypeScript
import { readFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
import { describe, expect, it } from "@suaveplan/testing/runner";
|
|
import * as rootBarrel from "../src/index.js";
|
|
|
|
describe("audio-cli subpath exports", () => {
|
|
it("every advertised subpath has an exports entry in package.json", {
|
|
timeout: 5000,
|
|
}, async () => {
|
|
const raw = await readFile(
|
|
join(__dirname, "..", "package.json"),
|
|
"utf8"
|
|
);
|
|
const pkg = JSON.parse(raw) as { exports: Record<string, unknown> };
|
|
for (const sub of [
|
|
".",
|
|
"./package.json",
|
|
"./cli",
|
|
"./error-codes",
|
|
"./pipeline/parser",
|
|
"./commands/process",
|
|
"./commands/batch",
|
|
"./commands/analyze",
|
|
"./commands/convert",
|
|
"./commands/info",
|
|
"./commands/play",
|
|
"./commands/record",
|
|
]) {
|
|
expect(
|
|
Object.hasOwn(pkg.exports, sub),
|
|
`missing export ${sub}`
|
|
).toBe(true);
|
|
}
|
|
});
|
|
|
|
it("root barrel exports AudioCLI, parsePipeline, error codes, every runX", {
|
|
timeout: 5000,
|
|
}, () => {
|
|
const expected = [
|
|
"AudioCLI",
|
|
"parsePipeline",
|
|
"validatePipeline",
|
|
"AUDIO_CLI_CODES",
|
|
"AudioCliError",
|
|
"EXIT_CODES",
|
|
"exitCodeFor",
|
|
"runProcess",
|
|
"runBatch",
|
|
"runAnalyze",
|
|
"runConvert",
|
|
"runInfo",
|
|
"runPlay",
|
|
"runRecord",
|
|
"createSilentMicrophone",
|
|
"noopSpeaker",
|
|
"createDefaultCodecRegistry",
|
|
"detectCodecForOutput",
|
|
];
|
|
for (const name of expected) {
|
|
expect(name in rootBarrel, `root barrel missing ${name}`).toBe(
|
|
true
|
|
);
|
|
}
|
|
});
|
|
});
|