Skip to content

Commit c410abd

Browse files
committed
Fix test assertions
1 parent 54368d7 commit c410abd

File tree

2 files changed

+53
-2
lines changed

2 files changed

+53
-2
lines changed

test/__snapshots__/index.test.ts.snap

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,31 @@ Object {
200200
}
201201
`;
202202

203+
exports[`validation tests fails without sending data 1`] = `
204+
Object {
205+
"reason": "smtp",
206+
"valid": false,
207+
"validators": Object {
208+
"disposable": Object {
209+
"valid": true,
210+
},
211+
"mx": Object {
212+
"valid": true,
213+
},
214+
"regex": Object {
215+
"valid": true,
216+
},
217+
"smtp": Object {
218+
"reason": "Mail server closed connection without sending any data.",
219+
"valid": false,
220+
},
221+
"typo": Object {
222+
"valid": true,
223+
},
224+
},
225+
}
226+
`;
227+
203228
exports[`validation tests passes when valid special char 1`] = `
204229
Object {
205230
"valid": true,
@@ -223,6 +248,29 @@ Object {
223248
}
224249
`;
225250

251+
exports[`validation tests passes when valid special char 2`] = `
252+
Object {
253+
"valid": true,
254+
"validators": Object {
255+
"disposable": Object {
256+
"valid": true,
257+
},
258+
"mx": Object {
259+
"valid": true,
260+
},
261+
"regex": Object {
262+
"valid": true,
263+
},
264+
"smtp": Object {
265+
"valid": true,
266+
},
267+
"typo": Object {
268+
"valid": true,
269+
},
270+
},
271+
}
272+
`;
273+
226274
exports[`validation tests passes when valid wildcard 1`] = `
227275
Object {
228276
"valid": true,

test/index.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ describe('validation tests', () => {
1212
validateTypo: false,
1313
validateDisposable: false,
1414
})
15-
console.log(res)
16-
}, 30000)
15+
expect(res.valid).toBe(false)
16+
expect(res.reason).toBe('smtp')
17+
expect(res.validators.smtp?.valid).toBe(false)
18+
expect(res).toMatchSnapshot()
19+
})
1720
it('fails with bad regex', async () => {
1821
const res = await validate('david.gmail.com')
1922
expect(res.valid).toBe(false)

0 commit comments

Comments
 (0)