29 lines
1.0 KiB
TypeScript
29 lines
1.0 KiB
TypeScript
import { readFile, stat } from "node:fs/promises";
|
|
import { fileURLToPath } from "node:url";
|
|
import { decodeWav } from "@suaveplan/audio-decode-wav";
|
|
import { describe, expect, it } from "@suaveplan/testing/runner";
|
|
import { CHANNELS, SAMPLE_RATE } from "../../src/manifest/manifest.js";
|
|
|
|
const WAV_URL = new URL(
|
|
"../../files/outdoor-swimming-pool.wav",
|
|
import.meta.url
|
|
);
|
|
|
|
describe("integration: file-presence", () => {
|
|
it("outdoor-swimming-pool.wav exists on disk and decodes", {
|
|
timeout: 30000,
|
|
}, async () => {
|
|
const path = fileURLToPath(WAV_URL);
|
|
const meta = await stat(path);
|
|
expect(meta.isFile()).toBe(true);
|
|
expect(meta.size).toBeGreaterThan(0);
|
|
|
|
const bytes = await readFile(path);
|
|
const decoded = await decodeWav(new Uint8Array(bytes));
|
|
expect(decoded.channels).toBe(CHANNELS);
|
|
expect(decoded.sampleRate).toBe(SAMPLE_RATE);
|
|
expect(decoded.channelData.length).toBe(CHANNELS);
|
|
expect(decoded.bytesDecoded).toBe(meta.size);
|
|
});
|
|
});
|