-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(package/checker): Add test for haveibeenpwned module
- Loading branch information
Showing
3 changed files
with
31 additions
and
4 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
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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict' | ||
|
||
describe('checker:haveibeenpwned', async () => { | ||
test('checks that an email has been pwned', async () => { | ||
global.nlu.brain.execute = jest.fn() | ||
await global.nlu.process('Has iifeoluwa.ao@gmail.com been pwned?') | ||
|
||
const [obj] = global.nlu.brain.execute.mock.calls | ||
await global.brain.execute(obj[0]) | ||
|
||
expect(global.brain.finalOutput.codes).toIncludeSameMembers(['checking', 'no-pwnage']) | ||
}) | ||
|
||
test('checks that multiple emails have been pwned', async () => { | ||
global.nlu.brain.execute = jest.fn() | ||
await global.nlu.process('Verify the pwnage status of iifeoluwa.ao@gmail.com and ifeoluwa1990@yahoo.com') | ||
|
||
const [obj] = global.nlu.brain.execute.mock.calls | ||
await global.brain.execute(obj[0]) | ||
|
||
expect(global.brain.finalOutput.codes).toIncludeSameMembers(['checking', 'no-pwnage', 'pwned']) | ||
}) | ||
}) |