@@ -2,22 +2,25 @@ import { describe, expect, it } from 'vitest';
22import { themes , AUTO_THEME_LIGHT , AUTO_THEME_DARK } from './themes' ;
33
44describe ( 'themes' , ( ) => {
5- it ( 'validates every theme has bg, text, accent, and negative as valid 6-character hex strings' , ( ) => {
5+ it ( 'validates every theme has bg, text, and accent as valid 6-character hex strings' , ( ) => {
66 const hexRegex = / ^ # [ 0 - 9 a - f ] { 6 } $ / i;
77
88 Object . entries ( themes ) . forEach ( ( [ name , theme ] ) => {
9- // Validate every theme has bg, text, accent, and negative
9+ // Validate every theme has bg, text, and accent
1010 expect ( theme ) . toHaveProperty ( 'bg' ) ;
1111 expect ( theme ) . toHaveProperty ( 'text' ) ;
1212 expect ( theme ) . toHaveProperty ( 'accent' ) ;
13- expect ( theme ) . toHaveProperty ( 'negative' ) ;
1413
1514 // Assert they are valid 6-character hex strings using the requested regex.
1615 // We prepend '#' because the sanitizer strips it from the final object.
1716 expect ( `#${ theme . bg } ` , `Theme "${ name } " bg is invalid` ) . toMatch ( hexRegex ) ;
1817 expect ( `#${ theme . text } ` , `Theme "${ name } " text is invalid` ) . toMatch ( hexRegex ) ;
1918 expect ( `#${ theme . accent } ` , `Theme "${ name } " accent is invalid` ) . toMatch ( hexRegex ) ;
20- expect ( `#${ theme . negative } ` , `Theme "${ name } " negative is invalid` ) . toMatch ( hexRegex ) ;
19+
20+ // negative is optional, but if present, must be valid hex
21+ if ( theme . negative ) {
22+ expect ( `#${ theme . negative } ` , `Theme "${ name } " negative is invalid` ) . toMatch ( hexRegex ) ;
23+ }
2124 } ) ;
2225 } ) ;
2326
@@ -40,4 +43,76 @@ describe('themes', () => {
4043 expect ( AUTO_THEME_LIGHT ) . toBe ( themes . light ) ;
4144 expect ( AUTO_THEME_DARK ) . toBe ( themes . dark ) ;
4245 } ) ;
46+
47+ describe ( 'new light theme variants' , ( ) => {
48+ it ( 'asserts aurora_cyberpunk theme exists' , ( ) => {
49+ expect ( themes ) . toHaveProperty ( 'aurora_cyberpunk' ) ;
50+ expect ( themes . aurora_cyberpunk ) . toBeDefined ( ) ;
51+ } ) ;
52+
53+ it ( 'asserts aurora_cyberpunk has valid bg, text, accent hex values' , ( ) => {
54+ const hexRegex = / ^ # [ 0 - 9 a - f ] { 6 } $ / i;
55+ const theme = themes . aurora_cyberpunk ;
56+
57+ expect ( `#${ theme . bg } ` ) . toMatch ( hexRegex ) ;
58+ expect ( `#${ theme . text } ` ) . toMatch ( hexRegex ) ;
59+ expect ( `#${ theme . accent } ` ) . toMatch ( hexRegex ) ;
60+ } ) ;
61+
62+ it ( 'asserts catppuccin_latte theme exists' , ( ) => {
63+ expect ( themes ) . toHaveProperty ( 'catppuccin_latte' ) ;
64+ expect ( themes . catppuccin_latte ) . toBeDefined ( ) ;
65+ } ) ;
66+
67+ it ( 'asserts catppuccin_latte has valid bg, text, accent hex values' , ( ) => {
68+ const hexRegex = / ^ # [ 0 - 9 a - f ] { 6 } $ / i;
69+ const theme = themes . catppuccin_latte ;
70+
71+ expect ( `#${ theme . bg } ` ) . toMatch ( hexRegex ) ;
72+ expect ( `#${ theme . text } ` ) . toMatch ( hexRegex ) ;
73+ expect ( `#${ theme . accent } ` ) . toMatch ( hexRegex ) ;
74+ } ) ;
75+
76+ it ( 'asserts solarized_light theme exists' , ( ) => {
77+ expect ( themes ) . toHaveProperty ( 'solarized_light' ) ;
78+ expect ( themes . solarized_light ) . toBeDefined ( ) ;
79+ } ) ;
80+
81+ it ( 'asserts solarized_light has valid bg, text, accent hex values' , ( ) => {
82+ const hexRegex = / ^ # [ 0 - 9 a - f ] { 6 } $ / i;
83+ const theme = themes . solarized_light ;
84+
85+ expect ( `#${ theme . bg } ` ) . toMatch ( hexRegex ) ;
86+ expect ( `#${ theme . text } ` ) . toMatch ( hexRegex ) ;
87+ expect ( `#${ theme . accent } ` ) . toMatch ( hexRegex ) ;
88+ } ) ;
89+
90+ it ( 'asserts gruvbox_light theme exists' , ( ) => {
91+ expect ( themes ) . toHaveProperty ( 'gruvbox_light' ) ;
92+ expect ( themes . gruvbox_light ) . toBeDefined ( ) ;
93+ } ) ;
94+
95+ it ( 'asserts gruvbox_light has valid bg, text, accent hex values' , ( ) => {
96+ const hexRegex = / ^ # [ 0 - 9 a - f ] { 6 } $ / i;
97+ const theme = themes . gruvbox_light ;
98+
99+ expect ( `#${ theme . bg } ` ) . toMatch ( hexRegex ) ;
100+ expect ( `#${ theme . text } ` ) . toMatch ( hexRegex ) ;
101+ expect ( `#${ theme . accent } ` ) . toMatch ( hexRegex ) ;
102+ } ) ;
103+
104+ it ( 'asserts nord_light theme exists' , ( ) => {
105+ expect ( themes ) . toHaveProperty ( 'nord_light' ) ;
106+ expect ( themes . nord_light ) . toBeDefined ( ) ;
107+ } ) ;
108+
109+ it ( 'asserts nord_light has valid bg, text, accent hex values' , ( ) => {
110+ const hexRegex = / ^ # [ 0 - 9 a - f ] { 6 } $ / i;
111+ const theme = themes . nord_light ;
112+
113+ expect ( `#${ theme . bg } ` ) . toMatch ( hexRegex ) ;
114+ expect ( `#${ theme . text } ` ) . toMatch ( hexRegex ) ;
115+ expect ( `#${ theme . accent } ` ) . toMatch ( hexRegex ) ;
116+ } ) ;
117+ } ) ;
43118} ) ;
0 commit comments