mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Avoid testing third-party code
- This test, though I understand why it was added, is not necessary in my opinion. It's more difficult to get this test to pass since we don't call session.run, we call session.writeTransaction which has a callback that calls transaction.run... - I think we don't need to test that our third party library does what it was added to do... they have their own tests, which can be found here @roschaefer, which I think are sufficient https://github.com/validatorjs/validator.js/blob/master/test/sanitizers.js - We can always add another type of test, if you feel necessary, maybe an e2e?
This commit is contained in:
parent
3c6932e21a
commit
b1c5c4dbf9
@ -1,37 +0,0 @@
|
||||
import createPasswordReset from './createPasswordReset'
|
||||
|
||||
describe('createPasswordReset', () => {
|
||||
const issuedAt = new Date()
|
||||
const nonce = 'abcdef'
|
||||
|
||||
describe('email lookup', () => {
|
||||
let driver
|
||||
let mockSession
|
||||
beforeEach(() => {
|
||||
mockSession = {
|
||||
close() {},
|
||||
writeTransaction: jest.fn().mockReturnValue({
|
||||
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.writeTransaction.run.mock.calls).toEqual([
|
||||
[
|
||||
expect.any(String),
|
||||
expect.objectContaining({
|
||||
email: 'strangecasing@example.org',
|
||||
}),
|
||||
],
|
||||
])
|
||||
})
|
||||
})
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user