2022-08-05 14:42:58 -05:00
|
|
|
import { assert, expect, test } from 'vitest';
|
2022-08-05 14:41:01 -05:00
|
|
|
|
|
|
|
// Edit an assertion and save to see HMR in action
|
|
|
|
|
|
|
|
test('Math.sqrt()', () => {
|
2022-08-05 14:42:58 -05:00
|
|
|
expect(Math.sqrt(4)).toBe(2);
|
|
|
|
expect(Math.sqrt(144)).toBe(12);
|
|
|
|
expect(Math.sqrt(2)).toBe(Math.SQRT2);
|
|
|
|
});
|
2022-08-05 14:41:01 -05:00
|
|
|
|
|
|
|
test('JSON', () => {
|
2022-08-05 14:42:58 -05:00
|
|
|
const input = {
|
|
|
|
foo: 'hello',
|
|
|
|
bar: 'world',
|
|
|
|
};
|
2022-08-05 14:41:01 -05:00
|
|
|
|
2022-08-05 14:42:58 -05:00
|
|
|
const output = JSON.stringify(input);
|
2022-08-05 14:41:01 -05:00
|
|
|
|
2022-08-05 14:42:58 -05:00
|
|
|
expect(output).eq('{"foo":"hello","bar":"world"}');
|
|
|
|
assert.deepEqual(JSON.parse(output), input, 'matches original');
|
|
|
|
});
|