mirror of
https://github.com/napi-rs/napi-rs.git
synced 2025-12-08 19:56:07 +00:00
test: fix some test case (#2301)
This commit is contained in:
parent
7ef54f413b
commit
7881069894
@ -95,21 +95,21 @@ test('should validate boolean value', (t) => {
|
||||
})
|
||||
|
||||
test('should validate date', (t) => {
|
||||
if (Number(process.versions.napi) >= 5) {
|
||||
if (Number(process.versions.napi) < 5) {
|
||||
return t.pass()
|
||||
}
|
||||
const fx = new Date('2016-12-24')
|
||||
t.is(validateDate(new Date()), fx.valueOf())
|
||||
t.is(validateDate(fx), fx.valueOf())
|
||||
t.is(validateDateTime(fx), 1)
|
||||
// @ts-expect-error
|
||||
t.throws(() => validateDate(1), {
|
||||
code: 'InvalidArg',
|
||||
message: 'Expected a Date value',
|
||||
message: 'Expected a Date object',
|
||||
})
|
||||
// @ts-expect-error
|
||||
t.throws(() => validateDateTime(2), {
|
||||
code: 'InvalidArg',
|
||||
message: 'Expected a Date value',
|
||||
message: 'Expected a Date object',
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user