@suluk/testgen 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suluk/testgen",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Generate a DETERMINISTIC conformance test suite from a v4 'Suluk' contract — the executable form of the contract's claims. Asserts the SERVER ENFORCES x-suluk-access on the real wire (anon rejected on non-public ops; public ops reachable), smoke-tests declared statuses, validates 2xx bodies against their declared schemas, and checks every declared cost is well-formed. A pure function of the document — same contract in, same suite out, no network at generate-time. CANDIDATE tooling.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -19,7 +19,7 @@
19
19
  ".": "./src/index.ts"
20
20
  },
21
21
  "dependencies": {
22
- "@suluk/core": "^0.1.11"
22
+ "@suluk/core": "^0.1.13"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@cfworker/json-schema": "^4.1.1"
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/bun": "latest",
34
- "@suluk/stripe": "^0.1.7"
34
+ "@suluk/payments": "^0.1.0"
35
35
  },
36
36
  "scripts": {
37
37
  "test": "bun test",
package/src/index.ts CHANGED
@@ -4,5 +4,5 @@
4
4
  * conform to their schemas, declared costs are well-formed. A pure function of the document. CANDIDATE tooling.
5
5
  */
6
6
  export { generateTests, type TestgenOptions } from "./generate";
7
- // money-correctness conformance (PARITY §2 checkout-resilience over the @suluk/stripe pricing primitives).
7
+ // money-correctness conformance (PARITY §2 checkout-resilience over the @suluk/payments pricing primitives).
8
8
  export { generateMoneyTests, type MoneyTestsOptions } from "./money";
package/src/money.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * generateMoneyTests — PARITY §2 "Checkout & E-commerce Resilience" made an EXECUTABLE, in-process conformance
3
- * suite over the @suluk/stripe pricing primitives (saastarter-parity Phase 0). Unlike the wire conformance suite,
3
+ * suite over the @suluk/payments pricing primitives (saastarter-parity Phase 0). Unlike the wire conformance suite,
4
4
  * the money invariants are properties of the SHARED, app-independent primitives (there is nothing in a v4 document
5
5
  * to walk for verifyAmount) — so this is a separate emitter that produces a self-contained `bun test` file an app
6
6
  * commits + runs. No network, no app coupling, no document input.
@@ -8,14 +8,14 @@
8
8
  * Provenance note (honesty, adopt-by-receipt): the anti-tampering + integer-cents + never-over-discount invariants
9
9
  * are faithful encodings of saastarter's checkout intent. The exact-sum proration + deterministic-idempotency
10
10
  * invariants are STRONGER than saastarter's actual code (PARITY records a real cart/order proration drift bug and
11
- * an ad-hoc retry path) — they assert what @suluk/stripe was authored to GUARANTEE, an origination inspired by the
11
+ * an ad-hoc retry path) — they assert what @suluk/payments was authored to GUARANTEE, an origination inspired by the
12
12
  * parity goal, not a behavioral port. The generated header says so.
13
13
  */
14
14
 
15
15
  export interface MoneyTestsOptions {
16
16
  /** which runner's imports to emit (both share test/expect/describe). Default "bun". */
17
17
  framework?: "bun" | "vitest";
18
- /** the import specifier for the pricing primitives. Default "@suluk/stripe". */
18
+ /** the import specifier for the pricing primitives. Default "@suluk/payments". */
19
19
  stripeModule?: string;
20
20
  }
21
21
 
@@ -24,16 +24,16 @@ export function generateMoneyTests(opts: MoneyTestsOptions = {}): string {
24
24
  const importLine = opts.framework === "vitest"
25
25
  ? `import { test, expect, describe } from "vitest";`
26
26
  : `import { test, expect, describe } from "bun:test";`;
27
- const mod = opts.stripeModule ?? "@suluk/stripe";
27
+ const mod = opts.stripeModule ?? "@suluk/payments";
28
28
 
29
29
  return `/**
30
30
  * Checkout money-correctness — CONFORMANCE suite. AUTO-GENERATED by @suluk/testgen. Do not edit.
31
31
  *
32
- * PARITY §2 "Checkout & E-commerce Resilience" made executable over the @suluk/stripe pricing primitives — the
32
+ * PARITY §2 "Checkout & E-commerce Resilience" made executable over the @suluk/payments pricing primitives — the
33
33
  * arithmetic that separates a toy cart from one you'd trust with money. In-process, no network: it asserts the
34
34
  * SHARED primitives uphold the invariants, so the cart-drawer total and the order-summary total can never drift.
35
35
  *
36
- * Honesty: the exact-sum proration + deterministic-idempotency checks assert what @suluk/stripe GUARANTEES — they
36
+ * Honesty: the exact-sum proration + deterministic-idempotency checks assert what @suluk/payments GUARANTEES — they
37
37
  * are stronger than saastarter's actual impl (which has a known proration-drift bug), an origination inspired by
38
38
  * the parity goal rather than a behavioral port.
39
39
  *
@@ -1,6 +1,6 @@
1
1
  import { test, expect, describe } from "bun:test";
2
2
  import { generateTests, generateMoneyTests } from "../src/index";
3
- import { orderTotal, verifyAmount, prorateDiscount, idempotencyKey } from "@suluk/stripe";
3
+ import { orderTotal, verifyAmount, prorateDiscount, idempotencyKey } from "@suluk/payments";
4
4
  import type { OpenAPIv4Document } from "@suluk/core";
5
5
 
6
6
  const doc = {
@@ -87,9 +87,9 @@ describe("@suluk/testgen — generate a conformance suite from a v4 contract", (
87
87
  describe("@suluk/testgen — generateMoneyTests (PARITY §2 checkout-resilience, in-process)", () => {
88
88
  const money = generateMoneyTests();
89
89
 
90
- test("emits a self-contained bun:test suite importing the @suluk/stripe primitives", () => {
90
+ test("emits a self-contained bun:test suite importing the @suluk/payments primitives", () => {
91
91
  expect(money).toContain('import { test, expect, describe } from "bun:test"');
92
- expect(money).toContain('} from "@suluk/stripe"');
92
+ expect(money).toContain('} from "@suluk/payments"');
93
93
  expect(money).toContain("verifyAmount");
94
94
  expect(money).toContain("prorateDiscount");
95
95
  expect(money).toContain("idempotencyKey");
@@ -114,8 +114,8 @@ describe("@suluk/testgen — generateMoneyTests (PARITY §2 checkout-resilience,
114
114
  });
115
115
  });
116
116
 
117
- // Smoke (closes the loop): the invariants the emitter ENCODES actually hold for the real @suluk/stripe build.
118
- describe("@suluk/testgen — money smoke against the real @suluk/stripe primitives", () => {
117
+ // Smoke (closes the loop): the invariants the emitter ENCODES actually hold for the real @suluk/payments build.
118
+ describe("@suluk/testgen — money smoke against the real @suluk/payments primitives", () => {
119
119
  test("verifyAmount rejects tampering; proration sums exactly; idempotency is deterministic", () => {
120
120
  const lines = [{ unitCents: 1999, qty: 2, id: "a" }, { unitCents: 500, qty: 1, id: "b" }, { unitCents: 333, qty: 3 }];
121
121
  const exact = orderTotal(lines, null).totalCents;