Convert to ESM

This commit is contained in:
Nick Alteen
2024-11-15 12:30:35 -05:00
parent 14c58ed4a7
commit 081d9e881a
28 changed files with 32080 additions and 9796 deletions

View File

@@ -1,18 +1,18 @@
/**
* Unit tests for src/wait.js
*/
const { wait } = require('../src/wait')
const { expect } = require('@jest/globals')
import { wait } from '../src/wait.js'
describe('wait.js', () => {
it('throws an invalid number', async () => {
it('Throws an invalid number', async () => {
const input = parseInt('foo', 10)
expect(isNaN(input)).toBe(true)
await expect(wait(input)).rejects.toThrow('milliseconds not a number')
await expect(wait(input)).rejects.toThrow('milliseconds is not a number')
})
it('waits with a valid number', async () => {
it('Waits with a valid number', async () => {
const start = new Date()
await wait(500)
const end = new Date()