Home Manual Reference Source Test

tests/instruments.test.js

  1. import { describe, it, expect } from "vitest";
  2. import { INSTRUMENTS } from "../src/model/instruments.js";
  3. /** @test {INSTRUMENTS} */
  4. describe("INSTRUMENTS", () => {
  5. /** @test {INSTRUMENTS} */
  6. it("holds 16 GM Level-1 families keyed by family name, each with 8 program names in canonical GM 1.0 ordering", () => {
  7. const families = Object.keys(INSTRUMENTS);
  8. expect(families).toHaveLength(16);
  9. expect(Object.values(INSTRUMENTS).every((list) => list.length === 8)).toBe(
  10. true,
  11. );
  12. expect(families[0]).toBe("Piano");
  13. expect(families[1]).toBe("Chromatic Percussion");
  14. expect(families[15]).toBe("Sound Effects");
  15. expect(INSTRUMENTS.Piano[0]).toBe("Acoustic Grand Piano");
  16. expect(INSTRUMENTS["Sound Effects"][7]).toBe("Gunshot");
  17. });
  18. });