@cimplify/sdk 0.44.16 → 0.44.18
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/dist/advanced.js +22 -21
- package/dist/advanced.mjs +3 -2
- package/dist/{chunk-MBGQP6FZ.js → chunk-3FS3ZDKX.js} +60 -60
- package/dist/chunk-53J2WE4S.js +657 -0
- package/dist/{chunk-UXLQ7WXI.mjs → chunk-5OK3YDZC.mjs} +2 -2
- package/dist/{chunk-MNIKXG7W.js → chunk-BN2CXGMO.js} +5 -272
- package/dist/{chunk-XL4CX75J.js → chunk-CCSONJCO.js} +235 -781
- package/dist/{chunk-CFD4J32N.js → chunk-HBRCVJL4.js} +22 -21
- package/dist/{chunk-ZLEFMQC6.mjs → chunk-MJBSVUHO.mjs} +2 -498
- package/dist/{chunk-6AZZ6AOF.mjs → chunk-NRT6PVW5.mjs} +4 -251
- package/dist/chunk-QBQCMQ4F.js +271 -0
- package/dist/chunk-VDH3O7UB.mjs +604 -0
- package/dist/chunk-XPXAZXF2.mjs +250 -0
- package/dist/{chunk-7NML226B.mjs → chunk-XZPO5GEM.mjs} +2 -1
- package/dist/client-B_Ei3ENB.d.mts +86 -0
- package/dist/client-Bep2FooI.d.ts +86 -0
- package/dist/index.js +145 -144
- package/dist/index.mjs +4 -3
- package/dist/react.js +81 -80
- package/dist/react.mjs +4 -3
- package/dist/server.js +6 -5
- package/dist/server.mjs +4 -3
- package/dist/testing/msw.d.mts +17 -0
- package/dist/testing/msw.d.ts +17 -0
- package/dist/testing/msw.js +42 -0
- package/dist/testing/msw.mjs +40 -0
- package/dist/testing/suite.d.mts +25 -0
- package/dist/testing/suite.d.ts +25 -0
- package/dist/testing/suite.js +28 -23
- package/dist/testing/suite.mjs +9 -4
- package/dist/testing.d.mts +643 -117
- package/dist/testing.d.ts +643 -117
- package/dist/testing.js +107 -59
- package/dist/testing.mjs +51 -4
- package/dist/utils.js +29 -28
- package/dist/utils.mjs +2 -1
- package/package.json +11 -2
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkCCSONJCO_js = require('../chunk-CCSONJCO.js');
|
|
4
|
+
require('../chunk-QBQCMQ4F.js');
|
|
5
|
+
|
|
6
|
+
// src/mock/msw.ts
|
|
7
|
+
async function createMswHandlers(options = {}) {
|
|
8
|
+
const baseUrl = options.baseUrl ?? "http://localhost:8787";
|
|
9
|
+
const handle = chunkCCSONJCO_js.createMockApp(options);
|
|
10
|
+
const msw = await import('msw').catch(() => {
|
|
11
|
+
throw new Error("msw is required to use @cimplify/sdk/mock/msw \u2014 install it as a peer dependency");
|
|
12
|
+
});
|
|
13
|
+
const proxy = async ({ request }) => {
|
|
14
|
+
const url = new URL(request.url);
|
|
15
|
+
const path = url.pathname + url.search;
|
|
16
|
+
const init = {
|
|
17
|
+
method: request.method,
|
|
18
|
+
headers: request.headers,
|
|
19
|
+
body: ["GET", "HEAD"].includes(request.method) ? void 0 : await request.text()
|
|
20
|
+
};
|
|
21
|
+
return handle.request(path, init);
|
|
22
|
+
};
|
|
23
|
+
const apiBase = baseUrl.replace(/\/$/, "");
|
|
24
|
+
const handlers = [
|
|
25
|
+
msw.http.all(`${apiBase}/api/v1/*`, proxy),
|
|
26
|
+
msw.http.all(`${apiBase}/_mock/*`, proxy),
|
|
27
|
+
msw.http.get(`${apiBase}/healthz`, proxy)
|
|
28
|
+
];
|
|
29
|
+
return {
|
|
30
|
+
handlers,
|
|
31
|
+
deps: handle.deps,
|
|
32
|
+
baseUrl,
|
|
33
|
+
reset: () => handle.deps.resetAll()
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/testing/msw-adapter.ts
|
|
38
|
+
async function createMswHandlers2(options = {}) {
|
|
39
|
+
return createMswHandlers(options);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
exports.createMswHandlers = createMswHandlers2;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createMockApp } from '../chunk-MJBSVUHO.mjs';
|
|
2
|
+
import '../chunk-XPXAZXF2.mjs';
|
|
3
|
+
|
|
4
|
+
// src/mock/msw.ts
|
|
5
|
+
async function createMswHandlers(options = {}) {
|
|
6
|
+
const baseUrl = options.baseUrl ?? "http://localhost:8787";
|
|
7
|
+
const handle = createMockApp(options);
|
|
8
|
+
const msw = await import('msw').catch(() => {
|
|
9
|
+
throw new Error("msw is required to use @cimplify/sdk/mock/msw \u2014 install it as a peer dependency");
|
|
10
|
+
});
|
|
11
|
+
const proxy = async ({ request }) => {
|
|
12
|
+
const url = new URL(request.url);
|
|
13
|
+
const path = url.pathname + url.search;
|
|
14
|
+
const init = {
|
|
15
|
+
method: request.method,
|
|
16
|
+
headers: request.headers,
|
|
17
|
+
body: ["GET", "HEAD"].includes(request.method) ? void 0 : await request.text()
|
|
18
|
+
};
|
|
19
|
+
return handle.request(path, init);
|
|
20
|
+
};
|
|
21
|
+
const apiBase = baseUrl.replace(/\/$/, "");
|
|
22
|
+
const handlers = [
|
|
23
|
+
msw.http.all(`${apiBase}/api/v1/*`, proxy),
|
|
24
|
+
msw.http.all(`${apiBase}/_mock/*`, proxy),
|
|
25
|
+
msw.http.get(`${apiBase}/healthz`, proxy)
|
|
26
|
+
];
|
|
27
|
+
return {
|
|
28
|
+
handlers,
|
|
29
|
+
deps: handle.deps,
|
|
30
|
+
baseUrl,
|
|
31
|
+
reset: () => handle.deps.resetAll()
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// src/testing/msw-adapter.ts
|
|
36
|
+
async function createMswHandlers2(options = {}) {
|
|
37
|
+
return createMswHandlers(options);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { createMswHandlers2 as createMswHandlers };
|
package/dist/testing/suite.d.mts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { TestAPI } from 'vitest';
|
|
2
|
+
import { T as TestClientHandle } from '../client-B_Ei3ENB.mjs';
|
|
1
3
|
import { C as CreateAppOptions } from '../server-CWpUlLOQ.mjs';
|
|
4
|
+
import '../client-Dh-bHyhU.mjs';
|
|
5
|
+
import '../payment-DA1i5hhk.mjs';
|
|
2
6
|
import 'hono';
|
|
3
7
|
|
|
4
8
|
/**
|
|
@@ -29,16 +33,33 @@ import 'hono';
|
|
|
29
33
|
* Brand sanity suite. Catches: missing required fields, placeholder
|
|
30
34
|
* strings shipped to prod, invalid email/url/locale/currency formats,
|
|
31
35
|
* mismatched seed/businessId pairing.
|
|
36
|
+
*
|
|
37
|
+
* Pass `extend` to append custom cases inside the same describe block:
|
|
38
|
+
*
|
|
39
|
+
* createBrandSuite({
|
|
40
|
+
* brand,
|
|
41
|
+
* extend: (it) => {
|
|
42
|
+
* it("uses our merchant's currency", () => {
|
|
43
|
+
* expect(brand.currency).toBe("GHS");
|
|
44
|
+
* });
|
|
45
|
+
* },
|
|
46
|
+
* });
|
|
32
47
|
*/
|
|
33
48
|
declare function createBrandSuite(opts: {
|
|
34
49
|
brand: unknown;
|
|
35
50
|
label?: string;
|
|
51
|
+
extend?: (it: TestAPI) => void;
|
|
36
52
|
}): void;
|
|
37
53
|
interface CartFlowOptions extends CreateAppOptions {
|
|
38
54
|
/** Expected business ID — asserts cart responses match the merchant. */
|
|
39
55
|
businessId?: string;
|
|
40
56
|
/** Override the describe() label. */
|
|
41
57
|
label?: string;
|
|
58
|
+
/** Append custom cases inside the same describe block. Receives a `TestClientHandle` getter. */
|
|
59
|
+
extend?: (ctx: {
|
|
60
|
+
getHandle: () => TestClientHandle;
|
|
61
|
+
it: TestAPI;
|
|
62
|
+
}) => void;
|
|
42
63
|
}
|
|
43
64
|
/**
|
|
44
65
|
* Cart flow suite. Boots the in-process mock, exercises add/dedupe/remove
|
|
@@ -49,6 +70,10 @@ interface CartFlowOptions extends CreateAppOptions {
|
|
|
49
70
|
declare function createCartFlowSuite(opts?: CartFlowOptions): void;
|
|
50
71
|
interface ContractOptions extends CreateAppOptions {
|
|
51
72
|
label?: string;
|
|
73
|
+
extend?: (ctx: {
|
|
74
|
+
getHandle: () => TestClientHandle;
|
|
75
|
+
it: TestAPI;
|
|
76
|
+
}) => void;
|
|
52
77
|
}
|
|
53
78
|
/**
|
|
54
79
|
* Shape contract suite. Exercises the schemas against actual mock
|
package/dist/testing/suite.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { TestAPI } from 'vitest';
|
|
2
|
+
import { T as TestClientHandle } from '../client-Bep2FooI.js';
|
|
1
3
|
import { C as CreateAppOptions } from '../server-CWpUlLOQ.js';
|
|
4
|
+
import '../client-D6ZisKco.js';
|
|
5
|
+
import '../payment-DA1i5hhk.js';
|
|
2
6
|
import 'hono';
|
|
3
7
|
|
|
4
8
|
/**
|
|
@@ -29,16 +33,33 @@ import 'hono';
|
|
|
29
33
|
* Brand sanity suite. Catches: missing required fields, placeholder
|
|
30
34
|
* strings shipped to prod, invalid email/url/locale/currency formats,
|
|
31
35
|
* mismatched seed/businessId pairing.
|
|
36
|
+
*
|
|
37
|
+
* Pass `extend` to append custom cases inside the same describe block:
|
|
38
|
+
*
|
|
39
|
+
* createBrandSuite({
|
|
40
|
+
* brand,
|
|
41
|
+
* extend: (it) => {
|
|
42
|
+
* it("uses our merchant's currency", () => {
|
|
43
|
+
* expect(brand.currency).toBe("GHS");
|
|
44
|
+
* });
|
|
45
|
+
* },
|
|
46
|
+
* });
|
|
32
47
|
*/
|
|
33
48
|
declare function createBrandSuite(opts: {
|
|
34
49
|
brand: unknown;
|
|
35
50
|
label?: string;
|
|
51
|
+
extend?: (it: TestAPI) => void;
|
|
36
52
|
}): void;
|
|
37
53
|
interface CartFlowOptions extends CreateAppOptions {
|
|
38
54
|
/** Expected business ID — asserts cart responses match the merchant. */
|
|
39
55
|
businessId?: string;
|
|
40
56
|
/** Override the describe() label. */
|
|
41
57
|
label?: string;
|
|
58
|
+
/** Append custom cases inside the same describe block. Receives a `TestClientHandle` getter. */
|
|
59
|
+
extend?: (ctx: {
|
|
60
|
+
getHandle: () => TestClientHandle;
|
|
61
|
+
it: TestAPI;
|
|
62
|
+
}) => void;
|
|
42
63
|
}
|
|
43
64
|
/**
|
|
44
65
|
* Cart flow suite. Boots the in-process mock, exercises add/dedupe/remove
|
|
@@ -49,6 +70,10 @@ interface CartFlowOptions extends CreateAppOptions {
|
|
|
49
70
|
declare function createCartFlowSuite(opts?: CartFlowOptions): void;
|
|
50
71
|
interface ContractOptions extends CreateAppOptions {
|
|
51
72
|
label?: string;
|
|
73
|
+
extend?: (ctx: {
|
|
74
|
+
getHandle: () => TestClientHandle;
|
|
75
|
+
it: TestAPI;
|
|
76
|
+
}) => void;
|
|
52
77
|
}
|
|
53
78
|
/**
|
|
54
79
|
* Shape contract suite. Exercises the schemas against actual mock
|
package/dist/testing/suite.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
3
|
+
var chunk53J2WE4S_js = require('../chunk-53J2WE4S.js');
|
|
4
|
+
require('../chunk-3FS3ZDKX.js');
|
|
5
|
+
require('../chunk-HBRCVJL4.js');
|
|
6
|
+
require('../chunk-BN2CXGMO.js');
|
|
7
|
+
require('../chunk-CCSONJCO.js');
|
|
8
|
+
require('../chunk-QBQCMQ4F.js');
|
|
7
9
|
var vitest = require('vitest');
|
|
8
10
|
|
|
9
11
|
var PLACEHOLDER_PHRASES = [
|
|
@@ -17,11 +19,11 @@ var PLACEHOLDER_PHRASES = [
|
|
|
17
19
|
function createBrandSuite(opts) {
|
|
18
20
|
vitest.describe(opts.label ?? "brand schema", () => {
|
|
19
21
|
vitest.it("conforms to the Cimplify brand contract", () => {
|
|
20
|
-
vitest.expect(() =>
|
|
22
|
+
vitest.expect(() => chunk53J2WE4S_js.assertBrand(opts.brand)).not.toThrow();
|
|
21
23
|
});
|
|
22
24
|
vitest.it("declares a known mock seed", () => {
|
|
23
25
|
const b = opts.brand;
|
|
24
|
-
vitest.expect(
|
|
26
|
+
vitest.expect(chunk53J2WE4S_js.SeedNameSchema.safeParse(b.mock?.seed).success).toBe(true);
|
|
25
27
|
});
|
|
26
28
|
vitest.it("has no placeholder copy left in", () => {
|
|
27
29
|
const flat = JSON.stringify(opts.brand).toLowerCase();
|
|
@@ -34,7 +36,7 @@ function createBrandSuite(opts) {
|
|
|
34
36
|
vitest.expect(b.mock?.businessId).toMatch(/^bus_/);
|
|
35
37
|
});
|
|
36
38
|
vitest.it("zod-parses cleanly", () => {
|
|
37
|
-
const result =
|
|
39
|
+
const result = chunk53J2WE4S_js.BrandSchema.safeParse(opts.brand);
|
|
38
40
|
if (!result.success) {
|
|
39
41
|
throw new Error(
|
|
40
42
|
"Brand schema violations:\n" + result.error.issues.map((i) => ` \u2022 brand.${i.path.join(".")}: ${i.message}`).join("\n")
|
|
@@ -42,29 +44,30 @@ function createBrandSuite(opts) {
|
|
|
42
44
|
}
|
|
43
45
|
vitest.expect(result.success).toBe(true);
|
|
44
46
|
});
|
|
47
|
+
opts.extend?.(vitest.it);
|
|
45
48
|
});
|
|
46
49
|
}
|
|
47
50
|
function createCartFlowSuite(opts = {}) {
|
|
48
51
|
vitest.describe(opts.label ?? "cart flow against in-process mock", () => {
|
|
49
52
|
let h;
|
|
50
53
|
vitest.beforeEach(() => {
|
|
51
|
-
h =
|
|
54
|
+
h = chunk53J2WE4S_js.createTestClient(opts);
|
|
52
55
|
});
|
|
53
56
|
vitest.afterEach(() => h.dispose());
|
|
54
57
|
vitest.it("starts with an empty cart matching the canonical shape", async () => {
|
|
55
58
|
const res = await h.client.cart.get();
|
|
56
59
|
vitest.expect(res.ok).toBe(true);
|
|
57
60
|
if (!res.ok) return;
|
|
58
|
-
vitest.expect(() =>
|
|
61
|
+
vitest.expect(() => chunk53J2WE4S_js.assertCart(res.value)).not.toThrow();
|
|
59
62
|
vitest.expect(res.value.items).toHaveLength(0);
|
|
60
63
|
});
|
|
61
64
|
vitest.it("adds the first product, persists it, and returns a shape-valid cart", async () => {
|
|
62
|
-
const { product, variantId } = await
|
|
65
|
+
const { product, variantId } = await chunk53J2WE4S_js.fixtures.addFirstProduct(h.client);
|
|
63
66
|
vitest.expect(product.id).toBeTruthy();
|
|
64
67
|
const get = await h.client.cart.get();
|
|
65
68
|
vitest.expect(get.ok).toBe(true);
|
|
66
69
|
if (!get.ok) return;
|
|
67
|
-
vitest.expect(() =>
|
|
70
|
+
vitest.expect(() => chunk53J2WE4S_js.assertCart(get.value)).not.toThrow();
|
|
68
71
|
vitest.expect(get.value.items).toHaveLength(1);
|
|
69
72
|
vitest.expect(get.value.items[0]?.item_id).toBe(product.id);
|
|
70
73
|
if (variantId) {
|
|
@@ -75,8 +78,8 @@ function createCartFlowSuite(opts = {}) {
|
|
|
75
78
|
vitest.expect(parseFloat(String(get.value.pricing.subtotal))).toBeGreaterThan(0);
|
|
76
79
|
});
|
|
77
80
|
vitest.it("dedupes by line_key when adding the same product twice", async () => {
|
|
78
|
-
await
|
|
79
|
-
await
|
|
81
|
+
await chunk53J2WE4S_js.fixtures.addFirstProduct(h.client);
|
|
82
|
+
await chunk53J2WE4S_js.fixtures.addFirstProduct(h.client);
|
|
80
83
|
const res = await h.client.cart.get();
|
|
81
84
|
vitest.expect(res.ok).toBe(true);
|
|
82
85
|
if (!res.ok) return;
|
|
@@ -84,7 +87,7 @@ function createCartFlowSuite(opts = {}) {
|
|
|
84
87
|
vitest.expect(res.value.items[0]?.quantity).toBe(2);
|
|
85
88
|
});
|
|
86
89
|
vitest.it("removes items and zeroes the subtotal", async () => {
|
|
87
|
-
await
|
|
90
|
+
await chunk53J2WE4S_js.fixtures.addFirstProduct(h.client);
|
|
88
91
|
const before = await h.client.cart.get();
|
|
89
92
|
if (!before.ok) throw before.error;
|
|
90
93
|
const itemId = before.value.items[0]?.id;
|
|
@@ -103,34 +106,35 @@ function createCartFlowSuite(opts = {}) {
|
|
|
103
106
|
vitest.expect(res.value.business_id).toBe(opts.businessId);
|
|
104
107
|
});
|
|
105
108
|
}
|
|
109
|
+
opts.extend?.({ getHandle: () => h, it: vitest.it });
|
|
106
110
|
});
|
|
107
111
|
}
|
|
108
112
|
function createContractSuite(opts = {}) {
|
|
109
113
|
vitest.describe(opts.label ?? "SDK \u2194 mock contract", () => {
|
|
110
114
|
let h;
|
|
111
115
|
vitest.beforeEach(() => {
|
|
112
|
-
h =
|
|
116
|
+
h = chunk53J2WE4S_js.createTestClient(opts);
|
|
113
117
|
});
|
|
114
118
|
vitest.afterEach(() => h.dispose());
|
|
115
119
|
vitest.it("AddItemPayload schema accepts a minimal valid body", () => {
|
|
116
|
-
const result =
|
|
120
|
+
const result = chunk53J2WE4S_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: 1 });
|
|
117
121
|
vitest.expect(result.success).toBe(true);
|
|
118
122
|
});
|
|
119
123
|
vitest.it("AddItemPayload schema rejects negative quantity", () => {
|
|
120
|
-
const result =
|
|
124
|
+
const result = chunk53J2WE4S_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: -1 });
|
|
121
125
|
vitest.expect(result.success).toBe(false);
|
|
122
126
|
});
|
|
123
127
|
vitest.it("AddItemPayload schema rejects empty item_id", () => {
|
|
124
|
-
const result =
|
|
128
|
+
const result = chunk53J2WE4S_js.AddItemPayloadSchema.safeParse({ item_id: "", quantity: 1 });
|
|
125
129
|
vitest.expect(result.success).toBe(false);
|
|
126
130
|
});
|
|
127
131
|
vitest.it("Cart line items returned by the mock match CartItemSchema", async () => {
|
|
128
|
-
const { product } = await
|
|
132
|
+
const { product } = await chunk53J2WE4S_js.fixtures.addFirstProduct(h.client);
|
|
129
133
|
const get = await h.client.cart.get();
|
|
130
134
|
if (!get.ok) throw get.error;
|
|
131
135
|
vitest.expect(get.value.items.length).toBeGreaterThan(0);
|
|
132
136
|
for (const item of get.value.items) {
|
|
133
|
-
const result =
|
|
137
|
+
const result = chunk53J2WE4S_js.CartItemSchema.safeParse(item);
|
|
134
138
|
if (!result.success) {
|
|
135
139
|
const issues = result.error.issues.map((i) => ` \u2022 ${i.path.join(".")}: ${i.message}`).join("\n");
|
|
136
140
|
throw new Error(`Cart item shape mismatch for ${product.name}:
|
|
@@ -140,19 +144,19 @@ ${issues}`);
|
|
|
140
144
|
}
|
|
141
145
|
});
|
|
142
146
|
vitest.it("CheckoutResponse from the mock includes bill_token", async () => {
|
|
143
|
-
await
|
|
147
|
+
await chunk53J2WE4S_js.fixtures.addFirstProduct(h.client);
|
|
144
148
|
const cartRes = await h.client.cart.get();
|
|
145
149
|
if (!cartRes.ok) throw cartRes.error;
|
|
146
150
|
const checkout = await h.client.checkout.process({
|
|
147
151
|
cart_id: cartRes.value.id,
|
|
148
|
-
customer:
|
|
152
|
+
customer: chunk53J2WE4S_js.fixtures.customer(),
|
|
149
153
|
order_type: "delivery",
|
|
150
154
|
payment_method: "mobile_money",
|
|
151
155
|
mobile_money_details: { phone_number: "+233244000000", provider: "mtn" }
|
|
152
156
|
});
|
|
153
157
|
vitest.expect(checkout.ok).toBe(true);
|
|
154
158
|
if (!checkout.ok) return;
|
|
155
|
-
const result =
|
|
159
|
+
const result = chunk53J2WE4S_js.CheckoutResponseSchema.safeParse(checkout.value);
|
|
156
160
|
if (!result.success) {
|
|
157
161
|
const issues = result.error.issues.map((i) => ` \u2022 ${i.path.join(".")}: ${i.message}`).join("\n");
|
|
158
162
|
throw new Error(`CheckoutResponse shape mismatch:
|
|
@@ -161,6 +165,7 @@ ${issues}`);
|
|
|
161
165
|
vitest.expect(checkout.value.bill_token).toBeTruthy();
|
|
162
166
|
vitest.expect(checkout.value.order_id).toBeTruthy();
|
|
163
167
|
});
|
|
168
|
+
opts.extend?.({ getHandle: () => h, it: vitest.it });
|
|
164
169
|
});
|
|
165
170
|
}
|
|
166
171
|
|
package/dist/testing/suite.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { assertBrand, SeedNameSchema, BrandSchema, createTestClient, assertCart, fixtures, AddItemPayloadSchema, CartItemSchema, CheckoutResponseSchema } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
import { assertBrand, SeedNameSchema, BrandSchema, createTestClient, assertCart, fixtures, AddItemPayloadSchema, CartItemSchema, CheckoutResponseSchema } from '../chunk-VDH3O7UB.mjs';
|
|
2
|
+
import '../chunk-5OK3YDZC.mjs';
|
|
3
|
+
import '../chunk-XZPO5GEM.mjs';
|
|
4
|
+
import '../chunk-NRT6PVW5.mjs';
|
|
5
|
+
import '../chunk-MJBSVUHO.mjs';
|
|
6
|
+
import '../chunk-XPXAZXF2.mjs';
|
|
5
7
|
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
6
8
|
|
|
7
9
|
var PLACEHOLDER_PHRASES = [
|
|
@@ -40,6 +42,7 @@ function createBrandSuite(opts) {
|
|
|
40
42
|
}
|
|
41
43
|
expect(result.success).toBe(true);
|
|
42
44
|
});
|
|
45
|
+
opts.extend?.(it);
|
|
43
46
|
});
|
|
44
47
|
}
|
|
45
48
|
function createCartFlowSuite(opts = {}) {
|
|
@@ -101,6 +104,7 @@ function createCartFlowSuite(opts = {}) {
|
|
|
101
104
|
expect(res.value.business_id).toBe(opts.businessId);
|
|
102
105
|
});
|
|
103
106
|
}
|
|
107
|
+
opts.extend?.({ getHandle: () => h, it });
|
|
104
108
|
});
|
|
105
109
|
}
|
|
106
110
|
function createContractSuite(opts = {}) {
|
|
@@ -159,6 +163,7 @@ ${issues}`);
|
|
|
159
163
|
expect(checkout.value.bill_token).toBeTruthy();
|
|
160
164
|
expect(checkout.value.order_id).toBeTruthy();
|
|
161
165
|
});
|
|
166
|
+
opts.extend?.({ getHandle: () => h, it });
|
|
162
167
|
});
|
|
163
168
|
}
|
|
164
169
|
|