53 lines
1.7 KiB
TypeScript
53 lines
1.7 KiB
TypeScript
import { readFileSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import { describe, expect, it } from "@suaveplan/testing/runner";
|
|
|
|
describe("exports", () => {
|
|
it("every feature module has a subpath export entry", {
|
|
timeout: 5000,
|
|
}, () => {
|
|
const pkg = JSON.parse(
|
|
readFileSync(join(__dirname, "..", "package.json"), "utf8")
|
|
) as { exports: Record<string, unknown> };
|
|
const required = [
|
|
".",
|
|
"./meter/loudness-meter",
|
|
"./algorithms/lufs",
|
|
"./algorithms/true-peak",
|
|
"./algorithms/loudness-range",
|
|
"./filters/k-weighting",
|
|
"./error-codes",
|
|
];
|
|
for (const sub of required) expect(sub in pkg.exports).toBe(true);
|
|
});
|
|
|
|
it("root barrel re-exports the documented surface", {
|
|
timeout: 5000,
|
|
}, async () => {
|
|
const mod = await import("../src/index.js");
|
|
const exports = Object.keys(mod);
|
|
const required = [
|
|
"LoudnessMeter",
|
|
"LoudnessMeterOptionsSchema",
|
|
"AudioAnalysisLoudnessError",
|
|
"AUDIO_ANALYSIS_LOUDNESS_CODES",
|
|
"AUDIO_ANALYSIS_LOUDNESS_ERROR_METADATA",
|
|
"registerAudioAnalysisLoudnessErrorCodes",
|
|
"buildKWeighting",
|
|
"createKWeighting",
|
|
"truePeakDbtp",
|
|
"samplePeakLinear",
|
|
"loudnessRange",
|
|
"momentaryLufs",
|
|
"shortTermLufs",
|
|
"IntegratedLoudness",
|
|
"energyToLufs",
|
|
"channelWeight",
|
|
"blockMeanSquare",
|
|
"combineChannelEnergies",
|
|
"percentile",
|
|
];
|
|
for (const sym of required) expect(exports).toContain(sym);
|
|
});
|
|
});
|