@@ -15,6 +15,13 @@ import {
1515} from './ascii-header.mts'
1616
1717describe ( 'ascii-header' , ( ) => {
18+ /**
19+ * Strip ANSI color codes from string for shimmer testing.
20+ */
21+ function stripAnsi ( str : string ) : string {
22+ return str . replace ( / \x1b \[ [ 0 - 9 ; ] * m / g, '' )
23+ }
24+
1825 describe ( 'supportsFullColor' , ( ) => {
1926 it ( 'should detect COLORTERM=truecolor' , ( ) => {
2027 const originalColorterm = process . env [ 'COLORTERM' ]
@@ -89,32 +96,32 @@ describe('ascii-header', () => {
8996 describe ( 'renderStaticLogo' , ( ) => {
9097 it ( 'should render logo with default theme' , ( ) => {
9198 const logo = renderStaticLogo ( )
92- expect ( logo ) . toContain ( 'Socket' )
99+ expect ( logo ) . toContain ( '| __|___' ) // ASCII art content
93100 expect ( logo ) . toContain ( '.dev' )
94101 expect ( logo ) . toContain ( '\x1b[38;2;' ) // Contains RGB color codes
95102 } )
96103
97104 it ( 'should render logo with cyberpunk theme' , ( ) => {
98105 const logo = renderStaticLogo ( 'cyberpunk' )
99- expect ( logo ) . toContain ( 'Socket' )
106+ expect ( logo ) . toContain ( '| __|___' ) // ASCII art content
100107 expect ( logo ) . toContain ( '.dev' )
101108 } )
102109
103110 it ( 'should render logo with forest theme' , ( ) => {
104111 const logo = renderStaticLogo ( 'forest' )
105- expect ( logo ) . toContain ( 'Socket' )
112+ expect ( logo ) . toContain ( '| __|___' ) // ASCII art content
106113 expect ( logo ) . toContain ( '.dev' )
107114 } )
108115
109116 it ( 'should render logo with ocean theme' , ( ) => {
110117 const logo = renderStaticLogo ( 'ocean' )
111- expect ( logo ) . toContain ( 'Socket' )
118+ expect ( logo ) . toContain ( '| __|___' ) // ASCII art content
112119 expect ( logo ) . toContain ( '.dev' )
113120 } )
114121
115122 it ( 'should render logo with sunset theme' , ( ) => {
116123 const logo = renderStaticLogo ( 'sunset' )
117- expect ( logo ) . toContain ( 'Socket' )
124+ expect ( logo ) . toContain ( '| __|___' ) // ASCII art content
118125 expect ( logo ) . toContain ( '.dev' )
119126 } )
120127
@@ -133,8 +140,9 @@ describe('ascii-header', () => {
133140 describe ( 'renderShimmerFrame' , ( ) => {
134141 it ( 'should render shimmer frame with default theme' , ( ) => {
135142 const logo = renderShimmerFrame ( 0 )
136- expect ( logo ) . toContain ( 'Socket' )
137- expect ( logo ) . toContain ( '.dev' )
143+ const stripped = stripAnsi ( logo )
144+ expect ( stripped ) . toContain ( '|' )
145+ expect ( stripped ) . toContain ( 'dev' )
138146 } )
139147
140148 it ( 'should render different frames differently' , ( ) => {
@@ -154,8 +162,9 @@ describe('ascii-header', () => {
154162 ]
155163 for ( const theme of themes ) {
156164 const logo = renderShimmerFrame ( 0 , theme )
157- expect ( logo ) . toContain ( 'Socket' )
158- expect ( logo ) . toContain ( '.dev' )
165+ const stripped = stripAnsi ( logo )
166+ expect ( stripped ) . toContain ( '|' )
167+ expect ( stripped ) . toContain ( 'dev' )
159168 }
160169 } )
161170
@@ -181,7 +190,7 @@ describe('ascii-header', () => {
181190 describe ( 'renderLogoWithFallback' , ( ) => {
182191 it ( 'should render static logo when frame is null' , ( ) => {
183192 const logo = renderLogoWithFallback ( null )
184- expect ( logo ) . toContain ( 'Socket' )
193+ expect ( logo ) . toContain ( '| __|___' ) // ASCII art content
185194 expect ( logo ) . toContain ( '.dev' )
186195 } )
187196
@@ -190,7 +199,9 @@ describe('ascii-header', () => {
190199 try {
191200 process . env [ 'COLORTERM' ] = 'truecolor'
192201 const logo = renderLogoWithFallback ( 0 )
193- expect ( logo ) . toContain ( 'Socket' )
202+ const stripped = stripAnsi ( logo )
203+ expect ( stripped ) . toContain ( '|' )
204+ expect ( stripped ) . toContain ( 'dev' )
194205 // With full color support, should use shimmer (contains bold)
195206 if ( supportsFullColor ( ) ) {
196207 expect ( logo ) . toContain ( '\x1b[1m' )
@@ -213,7 +224,7 @@ describe('ascii-header', () => {
213224 delete process . env [ 'TERM_PROGRAM' ]
214225 process . env [ 'TERM' ] = 'xterm'
215226 const logo = renderLogoWithFallback ( 0 )
216- expect ( logo ) . toContain ( 'Socket' )
227+ expect ( logo ) . toContain ( '| __|___' ) // ASCII art content
217228 // Without full color support, should use simple colors (no RGB codes)
218229 if ( ! supportsFullColor ( ) ) {
219230 expect ( logo ) . not . toContain ( '\x1b[38;2;' )
@@ -241,7 +252,7 @@ describe('ascii-header', () => {
241252 ]
242253 for ( const theme of themes ) {
243254 const logo = renderLogoWithFallback ( null , theme )
244- expect ( logo ) . toContain ( 'Socket' )
255+ expect ( logo ) . toContain ( '| __|___' ) // ASCII art content
245256 }
246257 } )
247258 } )
@@ -284,7 +295,7 @@ describe('ascii-header', () => {
284295 if ( isVitest ) {
285296 // When running under vitest, prefer static logo
286297 const logo = renderLogoWithFallback ( null )
287- expect ( logo ) . toContain ( 'Socket' )
298+ expect ( logo ) . toContain ( '| __|___' ) // ASCII art content
288299 }
289300 } )
290301
@@ -315,14 +326,16 @@ describe('ascii-header', () => {
315326 describe ( 'edge cases' , ( ) => {
316327 it ( 'should handle very large frame numbers' , ( ) => {
317328 const logo = renderShimmerFrame ( 1000000 )
318- expect ( logo ) . toContain ( 'Socket' )
319- expect ( logo ) . toContain ( '.dev' )
329+ const stripped = stripAnsi ( logo )
330+ expect ( stripped ) . toContain ( '|' )
331+ expect ( stripped ) . toContain ( 'dev' )
320332 } )
321333
322334 it ( 'should handle negative frame numbers' , ( ) => {
323335 const logo = renderShimmerFrame ( - 10 )
324- expect ( logo ) . toContain ( 'Socket' )
325- expect ( logo ) . toContain ( '.dev' )
336+ const stripped = stripAnsi ( logo )
337+ expect ( stripped ) . toContain ( '|' )
338+ expect ( stripped ) . toContain ( 'dev' )
326339 } )
327340
328341 it ( 'should handle frame 0 consistently' , ( ) => {
0 commit comments