@@ -4,8 +4,10 @@ import { ConfigSchema, type Config } from '~/config';
44import { ZodError } from 'zod' ;
55
66describe ( 'BaseClient' , ( ) => {
7- const nonEmailWarningMessage =
8- '[confluence.js] authentication.basic.email is not a valid email address; treating it as login workaround.' ;
7+ const nonEmailWarningText =
8+ 'authentication.basic.email is not a valid email address; treating it as login workaround.' ;
9+ const highlightedNonEmailWarningMessage =
10+ `\x1b[33m[confluence.js warning]\x1b[0m ${ nonEmailWarningText } ` ;
911
1012 describe ( 'constructor' , ( ) => {
1113 it ( 'should set default apiPrefix if not provided' , ( ) => {
@@ -81,7 +83,7 @@ describe('BaseClient', () => {
8183 } ,
8284 } ) ;
8385
84- expect ( warnSpy ) . toHaveBeenCalledWith ( nonEmailWarningMessage ) ;
86+ expect ( warnSpy ) . toHaveBeenCalledWith ( highlightedNonEmailWarningMessage ) ;
8587
8688 warnSpy . mockRestore ( ) ;
8789 } ) ;
@@ -100,7 +102,25 @@ describe('BaseClient', () => {
100102 } ,
101103 } ) ;
102104
103- expect ( warnSpy ) . not . toHaveBeenCalledWith ( nonEmailWarningMessage ) ;
105+ expect ( warnSpy ) . not . toHaveBeenCalled ( ) ;
106+
107+ warnSpy . mockRestore ( ) ;
108+ } ) ;
109+
110+ it ( 'should print highlighted warning prefix when non-email login is provided' , ( ) => {
111+ const warnSpy = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => undefined ) ;
112+
113+ new BaseClient ( {
114+ host : 'https://example.com' ,
115+ authentication : {
116+ basic : {
117+ email : 'server-login' ,
118+ apiToken : 'token' ,
119+ } ,
120+ } ,
121+ } ) ;
122+
123+ expect ( warnSpy ) . toHaveBeenCalledWith ( highlightedNonEmailWarningMessage ) ;
104124
105125 warnSpy . mockRestore ( ) ;
106126 } ) ;
0 commit comments