Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

projectIdentity.test.ts

34 lines1.1 KB

1import { describe, expect, it } from "vite-plus/test";
2import { deriveProjectIdentity } from "./projectIdentity";
3​
4describe("deriveProjectIdentity", () => {
5 it.each([
6 ["Nebula", "NA"],
7 ["Silver Orchard", "SO"],
8 ["Quiet Lantern Workshop", "QW"],
9 ["m7forge", "M7"],
10 ["M7 Forge", "M7"],
11 ["X", "XX"],
12 ["---", "PR"],
13 ])("derives %s as %s", (projectName, expected) => {
14 expect(deriveProjectIdentity(projectName).monogram).toBe(expected);
15 });
16​
17 it("keeps the palette stable across case and surrounding whitespace", () => {
18 const canonical = deriveProjectIdentity("Nebula");
19 const equivalent = deriveProjectIdentity(" NEBULA ");
20​
21 expect(equivalent.background).toBe(canonical.background);
22 expect(equivalent.highlight).toBe(canonical.highlight);
23 });
24​
25 it("generates different hues for different project names", () => {
26 const colors = new Set(
27 ["Nebula", "M7 Forge", "Silver Orchard", "Blue Harbor", "Copper Finch", "Juniper Vale"].map(
28 (projectName) => deriveProjectIdentity(projectName).background,
29 ),
30 );
31​
32 expect(colors.size).toBeGreaterThan(1);
33 });
34});