@@ -135,13 +135,17 @@ describe( 'pickWelcomeErrorMessage', () => {
135135 ) ;
136136 }
137137
138- it ( 'appends the plugin-settings hint for lw-harbor-invalid-key' , ( ) => {
138+ it ( 'returns a single canned message for lw-harbor-invalid-key' , ( ) => {
139139 const error = withCause ( 'lw-harbor-invalid-key' , 'License key not recognized.' ) ;
140140 const result = pickWelcomeErrorMessage ( error ) ;
141141
142- expect ( result . startsWith ( 'License key not recognized.' ) ) . toBe ( true ) ;
142+ // The canned message discards the server text and directs the user
143+ // toward the plugin-settings path.
144+ expect ( result ) . toMatch ( / W e c o u l d n ' t v e r i f y t h i s k e y / ) ;
143145 expect ( result ) . toMatch ( / n o n - u n i f i e d l i c e n s e / ) ;
144146 expect ( result ) . toMatch ( / p l u g i n ' s o w n s e t t i n g s p a g e / ) ;
147+ // The server's diagnostic is intentionally not surfaced.
148+ expect ( result ) . not . toMatch ( / L i c e n s e k e y n o t r e c o g n i z e d \. / ) ;
145149 } ) ;
146150
147151 it . each ( [
@@ -170,13 +174,13 @@ describe( 'pickWelcomeErrorMessage', () => {
170174 expect ( result ) . not . toMatch ( / n o n - u n i f i e d l i c e n s e / ) ;
171175 } ) ;
172176
173- it ( 'falls back to error. message when cause.message is whitespace' , ( ) => {
177+ it ( 'returns the canned invalid-key message even when cause.message is whitespace' , ( ) => {
174178 const error = withCause ( 'lw-harbor-invalid-key' , ' ' ) ;
175179 const result = pickWelcomeErrorMessage ( error ) ;
176180
177- // The wrapper message is preserved, and the plugin-settings hint is
178- // still appended because the server code matched .
179- expect ( result . startsWith ( 'Liquid Web Software Manager failed to validate your license.' ) ) . toBe ( true ) ;
181+ // Whitespace in the server message doesn't change anything — the
182+ // invalid-key branch returns the canned message regardless .
183+ expect ( result ) . toMatch ( / W e c o u l d n ' t v e r i f y t h i s k e y / ) ;
180184 expect ( result ) . toMatch ( / p l u g i n ' s o w n s e t t i n g s p a g e / ) ;
181185 } ) ;
182186} ) ;
0 commit comments