diff options
author | 2025-06-05 12:45:05 +0000 | |
---|---|---|
committer | 2025-06-05 12:45:05 +0000 | |
commit | 5b98691167898e7ebd06735861300f49b04ef4e7 (patch) | |
tree | 2fdf8d08b088d4d827f9ef770d6ecc4c96b84716 /test/basic.test.ts | |
download | astro-examples/with-vitest.tar.gz astro-examples/with-vitest.tar.zst astro-examples/with-vitest.zip |
Sync from 0947a69192ad6820970902c7c951fb0cf31fcf4bexamples/with-vitest
Diffstat (limited to 'test/basic.test.ts')
-rw-r--r-- | test/basic.test.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/basic.test.ts b/test/basic.test.ts new file mode 100644 index 000000000..f4677c6cb --- /dev/null +++ b/test/basic.test.ts @@ -0,0 +1,21 @@ +import { assert, expect, test } from 'vitest'; + +// Edit an assertion and save to see HMR in action + +test('Math.sqrt()', () => { + expect(Math.sqrt(4)).toBe(2); + expect(Math.sqrt(144)).toBe(12); + expect(Math.sqrt(2)).toBe(Math.SQRT2); +}); + +test('JSON', () => { + const input = { + foo: 'hello', + bar: 'world', + }; + + const output = JSON.stringify(input); + + expect(output).eq('{"foo":"hello","bar":"world"}'); + assert.deepEqual(JSON.parse(output), input, 'matches original'); +}); |