Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
21 lines
664 B
Plaintext
21 lines
664 B
Plaintext
'use strict'
|
|
|
|
const { test } = require('node:test')
|
|
const createDate = require('./create-date')
|
|
|
|
const wanted = 1624450038567
|
|
|
|
test('accepts arguments the Date constructor would accept', t => {
|
|
t.plan(2)
|
|
t.assert.strictEqual(createDate(1624450038567).getTime(), wanted)
|
|
t.assert.strictEqual(createDate('2021-06-23T12:07:18.567Z').getTime(), wanted)
|
|
})
|
|
|
|
test('accepts epoch as a string', t => {
|
|
// If Date() accepts this argument, the createDate function is not needed
|
|
// and can be replaced with Date()
|
|
t.plan(2)
|
|
t.assert.notEqual(new Date('16244500385-67').getTime(), wanted)
|
|
t.assert.strictEqual(createDate('1624450038567').getTime(), wanted)
|
|
})
|