portfolio/test/config/Art.spec.ts

38 lines
880 B
TypeScript
Raw Normal View History

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