Add a Vitest unit test suite (cart totals, invoice tax grouping, bundle contents)
No test infrastructure existed in this repo yet. Covers the pure logic most likely to silently produce wrong numbers on a live order: discount/ shipping math, per-rate invoice grouping, and bundle-contents string building. Extracted describeBundleContents() out of the checkout route into its own module so it's importable from a test (route.ts files only allow HTTP-method exports).
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { defineConfig } from "vitest/config";
|
||||
|
||||
// Pure-logic unit tests only (cart/discount math, invoice tax-rate
|
||||
// grouping, bundle-contents string building) — no jsdom, no Next.js
|
||||
// server runtime, no Payload/DB. `node` environment is enough since none
|
||||
// of this touches the DOM. See each app/lib/**/__tests__ file for what's
|
||||
// covered and why.
|
||||
export default defineConfig({
|
||||
test: {
|
||||
environment: "node",
|
||||
include: ["app/**/__tests__/**/*.test.ts"],
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user