-
-
Notifications
You must be signed in to change notification settings - Fork 36
/
mod.test.ts
85 lines (78 loc) · 2.29 KB
/
mod.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import { assertEquals } from "std/assert/assert_equals.ts";
import { flavorEntries, flavors, version } from "@catppuccin/palette";
import palette from "@/palette.json" with { type: "json" };
Deno.test("flavorEntries", () => {
flavorEntries.map(([flavorName, flavor]) => {
flavor.colorEntries.map(([colorName, color]) =>
assertEquals(color.hex, palette[flavorName].colors[colorName].hex)
);
});
});
Deno.test("flavors", () => {
flavorEntries.map(([flavorName]) => {
assertEquals(flavors[flavorName].name, palette[flavorName].name);
});
});
Deno.test("ansiEntries", () => {
flavorEntries.map(([flavorName, flavor]) => {
flavor.ansiColorEntries.map(([ansiColorName, ansiColor]) => {
assertEquals(
ansiColor.normal.name,
ansiColor.name
);
assertEquals(
ansiColor.bright.name,
`Bright ${ansiColor.name}`
);
assertEquals(
ansiColor.normal.hex,
palette[flavorName].ansiColors[ansiColorName].normal.hex,
);
if (ansiColorName == "black") {
if (flavorName == "latte") {
assertEquals(
ansiColor.normal.hex,
palette[flavorName].colors.subtext1.hex,
);
assertEquals(
ansiColor.bright.hex,
palette[flavorName].colors.subtext0.hex,
);
} else {
assertEquals(
ansiColor.normal.hex,
palette[flavorName].colors.surface1.hex,
);
assertEquals(
ansiColor.bright.hex,
palette[flavorName].colors.surface2.hex,
);
}
}
if (ansiColorName == "white") {
if (flavorName == "latte") {
assertEquals(
ansiColor.normal.hex,
palette[flavorName].colors.surface2.hex,
);
assertEquals(
ansiColor.bright.hex,
palette[flavorName].colors.surface1.hex,
);
} else {
assertEquals(
ansiColor.normal.hex,
palette[flavorName].colors.subtext0.hex,
);
assertEquals(
ansiColor.bright.hex,
palette[flavorName].colors.subtext1.hex,
);
}
}
});
});
});
Deno.test("version", () => {
assertEquals(version, "1.7.1"); // x-release-please-version
});