Initial Commit
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { readFileSync, statSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { describe, expect, it } from "@suaveplan/testing/runner";
|
||||
|
||||
const FILES_ROOT = new URL("../../files/", import.meta.url);
|
||||
|
||||
describe("file-presence", () => {
|
||||
it("club1.wav and club2.wav exist on disk and are non-empty", {
|
||||
timeout: 5000,
|
||||
}, () => {
|
||||
for (const name of ["club1.wav", "club2.wav"]) {
|
||||
const path = fileURLToPath(new URL(name, FILES_ROOT));
|
||||
const stat = statSync(path);
|
||||
expect(stat.isFile()).toBe(true);
|
||||
expect(stat.size).toBeGreaterThan(0);
|
||||
const bytes = readFileSync(path);
|
||||
expect(bytes.byteLength).toBe(stat.size);
|
||||
expect(
|
||||
String.fromCharCode(bytes[0]!, bytes[1]!, bytes[2]!, bytes[3]!)
|
||||
).toBe("RIFF");
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user