1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-12-30 04:05:58 +03:00
leon/packages/checker/test/haveibeenpwned.spec.js
2021-03-03 17:09:31 +08:00

22 lines
889 B
JavaScript

describe('checker:haveibeenpwned', async () => {
test('checks if an email address has been pwned', async () => {
global.nlu.brain.execute = jest.fn()
await global.nlu.process('Has supercleanemailaddress@supercleandomainname.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 if multiple email addresses have been pwned', async () => {
global.nlu.brain.execute = jest.fn()
await global.nlu.process('Verify the pwnage status of supercleanemailaddress@supercleandomainname.com and test@toto.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'])
})
})