2019-04-17 14:00:54 +03:00
|
|
|
describe('checker:haveibeenpwned', async () => {
|
2019-04-27 07:12:04 +03:00
|
|
|
test('checks if an email address has been pwned', async () => {
|
2019-04-17 14:00:54 +03:00
|
|
|
global.nlu.brain.execute = jest.fn()
|
2019-04-27 07:12:04 +03:00
|
|
|
await global.nlu.process('Has supercleanemailaddress@supercleandomainname.com been pwned?')
|
2019-04-17 14:00:54 +03:00
|
|
|
|
|
|
|
const [obj] = global.nlu.brain.execute.mock.calls
|
|
|
|
await global.brain.execute(obj[0])
|
|
|
|
|
|
|
|
expect(global.brain.finalOutput.codes).toIncludeSameMembers(['checking', 'no-pwnage'])
|
|
|
|
})
|
|
|
|
|
2019-04-27 07:12:04 +03:00
|
|
|
test('checks if multiple email addresses have been pwned', async () => {
|
2019-04-17 14:00:54 +03:00
|
|
|
global.nlu.brain.execute = jest.fn()
|
2019-04-27 07:12:04 +03:00
|
|
|
await global.nlu.process('Verify the pwnage status of supercleanemailaddress@supercleandomainname.com and test@toto.com')
|
2019-04-17 14:00:54 +03:00
|
|
|
|
|
|
|
const [obj] = global.nlu.brain.execute.mock.calls
|
|
|
|
await global.brain.execute(obj[0])
|
|
|
|
|
|
|
|
expect(global.brain.finalOutput.codes).toIncludeSameMembers(['checking', 'no-pwnage', 'pwned'])
|
|
|
|
})
|
|
|
|
})
|