diff options
author | 2025-06-05 14:25:23 +0000 | |
---|---|---|
committer | 2025-06-05 14:25:23 +0000 | |
commit | e586d7d704d475afe3373a1de6ae20d504f79d6d (patch) | |
tree | 7e3fa24807cebd48a86bd40f866d792181191ee9 /examples/with-vitest/test/basic.test.ts | |
download | astro-latest.tar.gz astro-latest.tar.zst astro-latest.zip |
Sync from a8e1c0a7402940e0fc5beef669522b315052df1blatest
Diffstat (limited to 'examples/with-vitest/test/basic.test.ts')
-rw-r--r-- | examples/with-vitest/test/basic.test.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/with-vitest/test/basic.test.ts b/examples/with-vitest/test/basic.test.ts new file mode 100644 index 000000000..f4677c6cb --- /dev/null +++ b/examples/with-vitest/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'); +}); |