-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modified the test to remove redundant test from last commit
- Loading branch information
1 parent
6fc1d81
commit 90290d1
Showing
1 changed file
with
24 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,10 +117,11 @@ describeTest('Integration CLI (Login)', function () { | |
}); | ||
|
||
// signup already taken email | ||
it('Should fail with taken email', async () => { | ||
it('Should fail with taken email and redirect to login', async () => { | ||
await clearCache(); | ||
let stdout = ''; | ||
try { | ||
const result = await runCLI( | ||
const result = runCLI( | ||
[], | ||
[ | ||
keys.down, | ||
|
@@ -132,17 +133,35 @@ describeTest('Integration CLI (Login)', function () { | |
keys.enter, | ||
'diaa', | ||
keys.enter, | ||
'diaa', | ||
'non-existing-alias', | ||
keys.enter | ||
] | ||
).promise; | ||
); | ||
|
||
// Attach an event listener to capture stdout | ||
result.child.stdout?.on('data', (data: Buffer) => { | ||
stdout += data.toString(); | ||
}); | ||
|
||
await result.promise; | ||
|
||
fail( | ||
`The CLI passed without errors and it should fail. Result: ${String( | ||
result | ||
)}` | ||
); | ||
} catch (error) { | ||
ok(String(error).includes('Account already exists')); | ||
// Check the error message | ||
ok( | ||
String(error).includes(`Account already exists.`), | ||
'Expected error message for existing account was not found.' | ||
); | ||
|
||
// Validate that the login method menu is printed after the error | ||
ok( | ||
String(stdout).includes('Select the login method'), | ||
'The CLI did not print the login method menu after the error.' | ||
); | ||
} | ||
}); | ||
|
||
|
@@ -207,52 +226,6 @@ describeTest('Integration CLI (Login)', function () { | |
} | ||
}); | ||
|
||
it('Should redirect to login when email is already associated with an account', async () => { | ||
await clearCache(); | ||
|
||
let stdout = ''; | ||
|
||
try { | ||
const process = runCLI( | ||
[], | ||
[ | ||
keys.down, | ||
keys.down, | ||
keys.enter, | ||
'[email protected]', | ||
keys.enter, | ||
'password123', | ||
keys.enter, | ||
'password123', | ||
keys.enter, | ||
'non-existing-alias', | ||
keys.enter | ||
] | ||
); | ||
|
||
// Attach an event listener to capture stdout | ||
process.child.stdout?.on('data', (data: Buffer) => { | ||
stdout += data.toString(); | ||
}); | ||
|
||
await process.promise; | ||
|
||
fail('The CLI did not throw an error when it should have.'); | ||
} catch (error) { | ||
// Check the error message | ||
ok( | ||
String(error).includes(`Account already exists.`), | ||
'Expected error message for existing account was not found.' | ||
); | ||
|
||
// Validate that the login method menu is printed after the error | ||
ok( | ||
String(stdout).includes('Select the login method'), | ||
'The CLI did not print the login method menu after the error.' | ||
); | ||
} | ||
}); | ||
|
||
// Note: Disable this test for now, I do not want to spam the FaaS | ||
// success signup | ||
/* | ||
|