@@ -25,6 +25,7 @@ describe('contentstack-auth plugin test', () => {
2525
2626 describe ( 'Check auth:login command with wrong credentials' , ( ) => {
2727 test
28+ . loadConfig ( { root : process . cwd ( ) } )
2829 // @ts -ignore
2930 . stub ( CliUx , 'inquire' , async ( inquire ) => {
3031 switch ( inquire . name ) {
@@ -34,24 +35,27 @@ describe('contentstack-auth plugin test', () => {
3435 return 'WrongPassword@12345%$#@!' ; // NOTE forcing wrong password
3536 }
3637 } )
38+ . stub ( process , 'exit' , ( ) => { } )
3739 . stdout ( { print : PRINT_LOGS || false } )
3840 . command ( [ 'auth:login' ] )
3941 . it ( 'Login should fail due to wrong credentials.!' , ( ctx ) => {
40- expect ( ctx . stdout ) . to . a ( 'string' ) . includes ( 'Login Error\nLooks like your email or password is invalid' ) ;
42+ expect ( ctx . stdout ) . to . be . includes ( 'Login Error\nLooks like your email or password is invalid. Please try again or reset your password. ' ) ;
4143 } ) ;
4244 } ) ;
4345
4446 describe ( 'Check auth:login command with --username, --password flags and wrong credentials' , ( ) => {
45- test
47+ test . loadConfig ( { root : process . cwd ( ) } )
4648 . stdout ( { print : PRINT_LOGS || false } )
49+ . stub ( process , 'exit' , ( ) => { } )
4750 . command ( [ 'auth:login' , `--username=${ username } ` , '--password=WrongPassword@12345%$#@!' ] )
4851 . it ( 'Login should fail due to wrong credentials.!' , ( ctx ) => {
49- expect ( ctx . stdout ) . to . a ( 'string' ) . includes ( 'Login Error\nLooks like your email or password is invalid' ) ;
52+ expect ( ctx . stdout ) . to . a ( 'string' ) . includes ( 'Login Error\nLooks like your email or password is invalid. Please try again or reset your password. ' ) ;
5053 } ) ;
5154 } ) ;
5255
56+ //NOTE
5357 describe ( 'Check auth:login command with correct credentials.' , ( ) => {
54- test
58+ test . loadConfig ( { root : process . cwd ( ) } )
5559 // @ts -ignore
5660 . stub ( CliUx , 'inquire' , async ( inquire ) => {
5761 switch ( inquire . name ) {
@@ -69,17 +73,17 @@ describe('contentstack-auth plugin test', () => {
6973 } ) ;
7074
7175 describe ( 'Check auth:logout command' , ( ) => {
72- test
76+ test . loadConfig ( { root : process . cwd ( ) } )
7377 . stub ( CliUx , 'inquire' , async ( ) => 'Yes' )
7478 . stdout ( { print : PRINT_LOGS || false } )
75- . command ( [ 'auth:logout' ] )
79+ . command ( [ 'auth:logout' , '--yes' ] )
7680 . it ( 'Logout should succeed.!' , ( ctx ) => {
7781 expect ( ctx . stdout ) . to . a ( 'string' ) . includes ( 'Successfully logged out' ) ;
7882 } ) ;
7983 } ) ;
8084
8185 describe ( 'Check auth:login command with --username, --password flags' , ( ) => {
82- test
86+ test . loadConfig ( { root : process . cwd ( ) } )
8387 . stdout ( { print : PRINT_LOGS || false } )
8488 . command ( [ 'auth:login' , `-u=${ username } ` , `-p=${ password } ` ] )
8589 . it ( 'Login should succeed!' , ( ctx ) => {
@@ -95,7 +99,7 @@ describe('contentstack-auth plugin test', () => {
9599 after ( ( ) => {
96100 mail = '' ;
97101 } ) ;
98- test
102+ test . loadConfig ( { root : process . cwd ( ) } )
99103 . stdout ( { print : PRINT_LOGS || false } )
100104 . command ( [ 'whoami' ] )
101105 . it ( 'shows user email who logged in' , ( ctx ) => {
0 commit comments