Last active
October 2, 2022 15:09
-
-
Save nathanclevenger/9baaa66d1c362689c62aa57c1d6b52e4 to your computer and use it in GitHub Desktop.
testing library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { test } from 'https://pkg.do/uvu'; | |
import * as assert from 'https://pkg.do/uvu/assert'; | |
test('Math.sqrt()', () => { | |
assert.is(Math.sqrt(4), 2); | |
assert.is(Math.sqrt(144), 12); | |
assert.is(Math.sqrt(2), Math.SQRT2); | |
}); | |
test('JSON', () => { | |
const input = { | |
foo: 'hello', | |
bar: 'world' | |
}; | |
const output = JSON.stringify(input); | |
assert.snapshot(output, `{"foo":"hello","bar":"world"}`); | |
assert.equal(JSON.parse(output), input, 'matches original'); | |
}); | |
test.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment