portfolio/test/config/Games.spec.ts

48 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Games } from "../../src/config/Games";
describe("games objects", () => {
it("should have unique names", () => {
expect.assertions(1);
const set = new Set(
Games.map((g) => {
return g.name;
}),
);
expect(set, "are not unique").toHaveLength(Games.length);
});
it("should have unique img properties", () => {
expect.assertions(1);
const set = new Set(
Games.map((g) => {
return g.img;
}),
);
expect(set, "are not unique").toHaveLength(Games.length);
});
it("should have unique urls", () => {
expect.assertions(1);
const set = new Set(
Games.map((g) => {
return g.url;
}),
);
expect(set, "are not unique").toHaveLength(Games.length);
});
it("should have alt text", () => {
expect.assertions(1);
const noText = Games.filter((g) => {
return g.alt.length === 0;
});
expect(noText, "found missing alt").toHaveLength(0);
});
});