mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2026-01-20 20:01:22 +00:00
36 lines
862 B
JavaScript
36 lines
862 B
JavaScript
import createPasswordReset from './createPasswordReset'
|
|
|
|
describe('createPasswordReset', () => {
|
|
const issuedAt = new Date()
|
|
const nonce = 'abcdef'
|
|
|
|
describe('email lookup', () => {
|
|
let driver
|
|
let mockSession
|
|
beforeEach(() => {
|
|
mockSession = {
|
|
close() {},
|
|
run: jest.fn().mockReturnValue({
|
|
records: {
|
|
map: jest.fn(() => []),
|
|
},
|
|
}),
|
|
}
|
|
driver = { session: () => mockSession }
|
|
})
|
|
|
|
it('lowercases email address', async () => {
|
|
const email = 'stRaNGeCaSiNG@ExAmplE.ORG'
|
|
await createPasswordReset({ driver, email, issuedAt, nonce })
|
|
expect(mockSession.run.mock.calls).toEqual([
|
|
[
|
|
expect.any(String),
|
|
expect.objectContaining({
|
|
email: 'strangecasing@example.org',
|
|
}),
|
|
],
|
|
])
|
|
})
|
|
})
|
|
})
|