Skip to content

Instantly share code, notes, and snippets.

@nathanclevenger
Last active October 2, 2022 15:09
Show Gist options
  • Save nathanclevenger/9baaa66d1c362689c62aa57c1d6b52e4 to your computer and use it in GitHub Desktop.
Save nathanclevenger/9baaa66d1c362689c62aa57c1d6b52e4 to your computer and use it in GitHub Desktop.
testing library
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