create-ailk 0.37.0 → 0.38.0

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.
Files changed (232) hide show
  1. package/README.md +149 -2
  2. package/component-catalog.json +44 -6
  3. package/component-catalog.md +6 -5
  4. package/dist/add-module.js +16 -1
  5. package/dist/add-route.d.ts +7 -2
  6. package/dist/add-route.js +28 -13
  7. package/dist/cli.js +52 -0
  8. package/dist/declined-routes.d.ts +13 -0
  9. package/dist/declined-routes.js +74 -0
  10. package/dist/derive-architecture.d.ts +0 -6
  11. package/dist/derive-architecture.js +9 -15
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.js +3 -0
  14. package/dist/language-import.d.ts +93 -0
  15. package/dist/language-import.js +270 -43
  16. package/dist/lib/import-mdx.js +1 -1
  17. package/dist/lib/scaffold-render-sweep.d.ts +6 -3
  18. package/dist/lib/scaffold-render-sweep.js +8 -4
  19. package/dist/migrate-content.d.ts +6 -2
  20. package/dist/migrate-content.js +62 -5
  21. package/dist/module-architecture.js +139 -103
  22. package/dist/paid-sections.d.ts +13 -0
  23. package/dist/paid-sections.js +35 -5
  24. package/dist/programmatic.js +6 -16
  25. package/dist/remove-module.js +67 -0
  26. package/dist/routes.d.ts +103 -0
  27. package/dist/routes.js +708 -0
  28. package/dist/site-manifest.js +1 -1
  29. package/dist/site-roster.d.ts +2 -1
  30. package/dist/site-roster.js +30 -8
  31. package/dist/spoke-checkout.d.ts +28 -27
  32. package/dist/spoke-checkout.js +71 -102
  33. package/dist/surfaces.d.ts +18 -0
  34. package/dist/surfaces.js +47 -282
  35. package/dist/sync-routes.d.ts +28 -1
  36. package/dist/sync-routes.js +144 -11
  37. package/dist/template-record.d.ts +11 -0
  38. package/dist/template-record.js +18 -0
  39. package/dist/topology.d.ts +15 -1
  40. package/dist/topology.js +20 -4
  41. package/dist/update.d.ts +31 -2
  42. package/dist/update.js +627 -99
  43. package/package.json +3 -3
  44. package/templates/README.md +1 -1
  45. package/templates/apps/mcp/CLAUDE.md +5 -3
  46. package/templates/apps/web/CLAUDE.md +62 -20
  47. package/templates/apps/web/account.config.tsx +101 -0
  48. package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +3 -161
  49. package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +3 -139
  50. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +3 -406
  51. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +2 -190
  52. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +3 -182
  53. package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +8 -420
  54. package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +1 -1
  55. package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +8 -214
  56. package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +8 -115
  57. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +2 -80
  58. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +8 -121
  59. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +3 -154
  60. package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +7 -149
  61. package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +3 -143
  62. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +3 -126
  63. package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +8 -302
  64. package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +2 -102
  65. package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +3 -240
  66. package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +3 -131
  67. package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +2 -24
  68. package/templates/apps/web/app/[locale]/(authed)/account/support/page.tsx +3 -60
  69. package/templates/apps/web/app/[locale]/layout.tsx +45 -28
  70. package/templates/apps/web/app/apple-icon.tsx +72 -0
  71. package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +22 -12
  72. package/templates/apps/web/app/og/__tests__/__snapshots__/card.test.tsx.snap +3 -0
  73. package/templates/apps/web/app/og/__tests__/card.test.tsx +129 -0
  74. package/templates/apps/web/app/og/__tests__/route.test.ts +3 -4
  75. package/templates/apps/web/app/og/route.tsx +155 -72
  76. package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +12 -0
  77. package/templates/apps/web/i18n/request.ts +44 -1
  78. package/templates/apps/web/jest.config.cjs +13 -1
  79. package/templates/apps/web/lib/__tests__/auth-phone.test.ts +11 -0
  80. package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +70 -0
  81. package/templates/apps/web/lib/__tests__/nav-label-keys.test.ts +14 -0
  82. package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +148 -61
  83. package/templates/apps/web/lib/__tests__/served-pages.test.ts +77 -0
  84. package/templates/apps/web/lib/__tests__/server-api.test.ts +37 -5
  85. package/templates/apps/web/lib/__tests__/structured-data.test.tsx +26 -13
  86. package/templates/apps/web/lib/listings.tsx +2 -2
  87. package/templates/apps/web/lib/nav-label-keys.ts +16 -2
  88. package/templates/apps/web/lib/paid-section-contracts.ts +35 -6
  89. package/templates/apps/web/lib/paid-sections.generated.ts +8 -0
  90. package/templates/apps/web/lib/profile-back-link.ts +105 -32
  91. package/templates/apps/web/lib/served-pages.ts +95 -0
  92. package/templates/apps/web/lib/site-brand.tsx +3 -5
  93. package/templates/apps/web/messages/en.json +8 -684
  94. package/templates/apps/web/middleware.ts +3 -1
  95. package/templates/apps/web/next.config.mjs +27 -0
  96. package/templates/apps/web/package.json +1 -0
  97. package/templates/customizations.yaml +9 -0
  98. package/templates/package.json +3 -1
  99. package/templates/tools/lint-architecture.ts +164 -11
  100. package/versions.json +48 -47
  101. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/account-frame-sign-out.test.tsx +0 -175
  102. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/agreements-prompt.test.tsx +0 -301
  103. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +0 -515
  104. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +0 -883
  105. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +0 -758
  106. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +0 -264
  107. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +0 -167
  108. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +0 -730
  109. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +0 -355
  110. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +0 -97
  111. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +0 -375
  112. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/onboarding.test.tsx +0 -323
  113. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +0 -1208
  114. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +0 -418
  115. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +0 -462
  116. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +0 -63
  117. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -406
  118. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/settings.test.tsx +0 -93
  119. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/support.test.tsx +0 -208
  120. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +0 -340
  121. package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +0 -182
  122. package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +0 -353
  123. package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +0 -57
  124. package/templates/apps/web/app/[locale]/(authed)/account/agreements-actions.ts +0 -58
  125. package/templates/apps/web/app/[locale]/(authed)/account/agreements-gate.ts +0 -61
  126. package/templates/apps/web/app/[locale]/(authed)/account/agreements-prompt.tsx +0 -184
  127. package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +0 -426
  128. package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +0 -76
  129. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/pay-form.tsx +0 -65
  130. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/review-form.tsx +0 -172
  131. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +0 -333
  132. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +0 -936
  133. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/pay.test.tsx +0 -193
  134. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/review.test.tsx +0 -476
  135. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-actions.ts +0 -184
  136. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +0 -197
  137. package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +0 -99
  138. package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +0 -123
  139. package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +0 -303
  140. package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +0 -274
  141. package/templates/apps/web/app/[locale]/(authed)/account/error-row.tsx +0 -35
  142. package/templates/apps/web/app/[locale]/(authed)/account/for-you-labels.ts +0 -36
  143. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +0 -215
  144. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +0 -65
  145. package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +0 -36
  146. package/templates/apps/web/app/[locale]/(authed)/account/general/billing-anchor.tsx +0 -27
  147. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +0 -149
  148. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +0 -42
  149. package/templates/apps/web/app/[locale]/(authed)/account/general/deletion-request.tsx +0 -132
  150. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +0 -122
  151. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +0 -215
  152. package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +0 -73
  153. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +0 -107
  154. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +0 -87
  155. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/__tests__/route.test.ts +0 -215
  156. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +0 -43
  157. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +0 -88
  158. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +0 -31
  159. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +0 -35
  160. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +0 -266
  161. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +0 -116
  162. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +0 -12
  163. package/templates/apps/web/app/[locale]/(authed)/account/new-actions.ts +0 -219
  164. package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +0 -365
  165. package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +0 -86
  166. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/actions.ts +0 -120
  167. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/onboarding-form.tsx +0 -322
  168. package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +0 -173
  169. package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +0 -103
  170. package/templates/apps/web/app/[locale]/(authed)/account/profile-actions.ts +0 -116
  171. package/templates/apps/web/app/[locale]/(authed)/account/retry-button.tsx +0 -27
  172. package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +0 -258
  173. package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +0 -130
  174. package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +0 -92
  175. package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +0 -121
  176. package/templates/apps/web/app/[locale]/(authed)/account/sign-in-method.ts +0 -37
  177. package/templates/apps/web/app/[locale]/(authed)/account/support/support-form.tsx +0 -98
  178. package/templates/apps/web/app/[locale]/(authed)/account/support-actions.ts +0 -100
  179. package/templates/apps/web/app/[locale]/checkout/__tests__/pages.test.tsx +0 -139
  180. package/templates/apps/web/app/[locale]/checkout/__tests__/thank-you-account.test.tsx +0 -146
  181. package/templates/apps/web/app/[locale]/checkout/thank-you/page.tsx +0 -114
  182. package/templates/apps/web/app/[locale]/checkout/unavailable/page.tsx +0 -51
  183. package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +0 -614
  184. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.count.test.tsx +0 -43
  185. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.deliverable.test.tsx +0 -214
  186. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.ending.test.tsx +0 -197
  187. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.invite.test.tsx +0 -286
  188. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.permalink.test.tsx +0 -520
  189. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.test.tsx +0 -376
  190. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.thanks-by-tier.test.tsx +0 -306
  191. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/account-invite.actions.test.ts +0 -69
  192. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/flow.actions.test.ts +0 -398
  193. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +0 -704
  194. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/save.actions.test.ts +0 -173
  195. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/two-route-tool.test.tsx +0 -141
  196. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/verify.test.tsx +0 -249
  197. package/templates/apps/web/app/[locale]/flows/[slug]/account-invite.actions.ts +0 -35
  198. package/templates/apps/web/app/[locale]/flows/[slug]/email-moment.ts +0 -92
  199. package/templates/apps/web/app/[locale]/flows/[slug]/flow.actions.ts +0 -177
  200. package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +0 -472
  201. package/templates/apps/web/app/[locale]/flows/[slug]/page.tsx +0 -48
  202. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/LevelChart.tsx +0 -100
  203. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsCard.tsx +0 -99
  204. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +0 -820
  205. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsEmailStep.tsx +0 -203
  206. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.no-commerce.test.tsx +0 -194
  207. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.report.test.tsx +0 -284
  208. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/by-result.test.tsx +0 -302
  209. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/cards.test.tsx +0 -402
  210. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/landing.test.tsx +0 -293
  211. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/page.test.tsx +0 -485
  212. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/score.test.tsx +0 -231
  213. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/checkout-seam.ts +0 -74
  214. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/meeting-seam.ts +0 -36
  215. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/page.tsx +0 -420
  216. package/templates/apps/web/app/[locale]/flows/[slug]/save.actions.ts +0 -85
  217. package/templates/apps/web/app/[locale]/flows/[slug]/served-flow.ts +0 -91
  218. package/templates/apps/web/app/[locale]/flows/[slug]/start/page.tsx +0 -32
  219. package/templates/apps/web/app/[locale]/flows/[slug]/verify/page.tsx +0 -153
  220. package/templates/apps/web/app/[locale]/flows/[slug]/verify.actions.ts +0 -151
  221. package/templates/apps/web/app/[locale]/meet/confirmed/BookingHandOff.tsx +0 -128
  222. package/templates/apps/web/app/[locale]/meet/confirmed/__tests__/BookingHandOff.test.tsx +0 -126
  223. package/templates/apps/web/app/[locale]/purchase/__tests__/cancel.test.tsx +0 -162
  224. package/templates/apps/web/app/[locale]/purchase/__tests__/module-scope.test.ts +0 -68
  225. package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +0 -411
  226. package/templates/apps/web/app/[locale]/purchase/cancel/page.tsx +0 -115
  227. package/templates/apps/web/app/[locale]/purchase/success/page.tsx +0 -348
  228. package/templates/apps/web/lib/__tests__/account-config.test.ts +0 -704
  229. package/templates/apps/web/lib/account-config.ts +0 -678
  230. package/templates/apps/web/lib/checkout-config.ts +0 -16
  231. package/templates/apps/web/src/lib/__tests__/commerce-sections.test.ts +0 -57
  232. package/templates/apps/web/src/lib/commerce-sections.ts +0 -55
@@ -1,193 +0,0 @@
1
- /**
2
- * Pay now on an approved proposal (#8516, spec
3
- * docs/specs/8516-proposals-as-an-artifact-kind-spec.md D19, AC-4, AC-7).
4
- *
5
- * Two layers:
6
- * - `payForProposal` (the Server Action), with the api-client's
7
- * `member.payArtifact` as the one mocked boundary: it asks once with the
8
- * caller's init and redirects only to a Stripe Checkout URL; a refusal, a
9
- * throw or a URL on any other host is `payment_failed` with no redirect,
10
- * and a log line carries `err.name` only — never the URL or the id.
11
- * - `PayForm` (the client form): one button and no input of any kind — no
12
- * card, number or expiry field; payment happens on Stripe's page.
13
- */
14
-
15
- import {
16
- act,
17
- fireEvent,
18
- render,
19
- screen,
20
- waitFor,
21
- } from "@testing-library/react";
22
-
23
- const mockPayArtifact = jest.fn();
24
- jest.mock("@working-theory/api-client", () => ({
25
- __esModule: true,
26
- member: {
27
- reviewArtifact: jest.fn(),
28
- payArtifact: (...args: unknown[]) => mockPayArtifact(...args),
29
- },
30
- }));
31
-
32
- jest.mock("next/headers", () => ({
33
- __esModule: true,
34
- headers: jest
35
- .fn()
36
- .mockResolvedValue(new Headers({ origin: "https://site.example.com" })),
37
- cookies: jest.fn().mockResolvedValue({ toString: () => "session=abc" }),
38
- }));
39
-
40
- // Next's `redirect()` throws NEXT_REDIRECT; the mock does too, so a catch
41
- // that swallowed it would show up as a resolved action.
42
- const mockRedirect = jest.fn((url: string): never => {
43
- throw new Error(`NEXT_REDIRECT ${url}`);
44
- });
45
- jest.mock("next/navigation", () => ({
46
- __esModule: true,
47
- useRouter: () => ({ push: jest.fn(), refresh: jest.fn() }),
48
- redirect: (url: string) => mockRedirect(url),
49
- }));
50
-
51
- import messages from "../../../../../../messages/en.json";
52
- import { PayForm, type PayFormLabels } from "../[pieceId]/pay-form";
53
- import * as actions from "../artifact-actions";
54
- import { payForProposal } from "../artifact-actions";
55
-
56
- const PIECE = "piece_01920000-0000-7000-8000-00000000000d";
57
- const INIT = {
58
- headers: { cookie: "session=abc", origin: "https://site.example.com" },
59
- };
60
- const CHECKOUT = "https://checkout.stripe.com/c/pay/cs_test_x";
61
- const p = messages.account.artifacts.proposal;
62
- const LABELS: PayFormLabels = {
63
- pay: p.pay,
64
- paying: p.paying,
65
- error: p.payError,
66
- };
67
-
68
- function pay(pieceId = PIECE) {
69
- const data = new FormData();
70
- data.set("pieceId", pieceId);
71
- return payForProposal({ kind: "idle" }, data);
72
- }
73
-
74
- function refusal(status: number, code: string) {
75
- return {
76
- ok: false,
77
- status,
78
- body: { ok: false, error: { code, message: "x" } },
79
- };
80
- }
81
-
82
- let errorSpy: jest.SpyInstance;
83
-
84
- beforeEach(() => {
85
- mockPayArtifact
86
- .mockReset()
87
- .mockResolvedValue({ ok: true, body: { url: CHECKOUT } });
88
- mockRedirect.mockClear();
89
- errorSpy = jest.spyOn(console, "error").mockImplementation(() => undefined);
90
- });
91
-
92
- afterEach(() => {
93
- errorSpy.mockRestore();
94
- });
95
-
96
- describe("payForProposal (D19, AC-4, AC-7)", () => {
97
- it("calls member.payArtifact once with the caller's init and redirects to the Checkout URL", async () => {
98
- await expect(pay()).rejects.toThrow("NEXT_REDIRECT");
99
- expect(mockPayArtifact).toHaveBeenCalledTimes(1);
100
- expect(mockPayArtifact).toHaveBeenCalledWith(PIECE, INIT);
101
- expect(mockRedirect).toHaveBeenCalledTimes(1);
102
- expect(mockRedirect).toHaveBeenCalledWith(CHECKOUT);
103
- });
104
-
105
- it.each([
106
- ["a 409 proposal_paid refusal", refusal(409, "proposal_paid")],
107
- ["a 404 (no payment surface)", refusal(404, "not_found")],
108
- ["a 502 payment_unavailable", refusal(502, "payment_unavailable")],
109
- [
110
- "a URL on another host",
111
- { ok: true, body: { url: "https://evil.example/x" } },
112
- ],
113
- [
114
- "a look-alike Stripe host",
115
- { ok: true, body: { url: "https://checkout.stripe.com.evil.example/x" } },
116
- ],
117
- [
118
- "a URL with userinfo",
119
- { ok: true, body: { url: "https://user@checkout.stripe.com/x" } },
120
- ],
121
- ["a body with no URL", { ok: true, body: {} }],
122
- ])("%s is payment_failed with no redirect", async (_case, res) => {
123
- mockPayArtifact.mockResolvedValue(res);
124
- await expect(pay()).resolves.toEqual({
125
- kind: "error",
126
- reason: "payment_failed",
127
- });
128
- expect(mockPayArtifact).toHaveBeenCalledTimes(1);
129
- expect(mockRedirect).not.toHaveBeenCalled();
130
- });
131
-
132
- it("a malformed piece id is payment_failed with no call", async () => {
133
- await expect(pay("x")).resolves.toEqual({
134
- kind: "error",
135
- reason: "payment_failed",
136
- });
137
- expect(mockPayArtifact).not.toHaveBeenCalled();
138
- expect(mockRedirect).not.toHaveBeenCalled();
139
- });
140
-
141
- it("a throw is payment_failed, logged by err.name only — never the URL or the piece id", async () => {
142
- mockPayArtifact.mockRejectedValue(
143
- new TypeError(`fetch failed ${CHECKOUT} ${PIECE}`),
144
- );
145
- await expect(pay()).resolves.toEqual({
146
- kind: "error",
147
- reason: "payment_failed",
148
- });
149
- expect(mockRedirect).not.toHaveBeenCalled();
150
- expect(errorSpy).toHaveBeenCalledWith(
151
- "[account] payment failed errName=TypeError",
152
- );
153
- const logged = JSON.stringify(errorSpy.mock.calls);
154
- expect(logged).not.toContain(CHECKOUT);
155
- expect(logged).not.toContain(PIECE);
156
- });
157
- });
158
-
159
- describe("PayForm (D19, AC-7)", () => {
160
- it("renders one primary Pay now button with a 44px target and no input of any kind", () => {
161
- const { container } = render(<PayForm pieceId={PIECE} labels={LABELS} />);
162
- expect(screen.getAllByRole("button")).toHaveLength(1);
163
- const button = screen.getByTestId("artifact-pay");
164
- expect(button).toHaveTextContent("Pay now");
165
- expect(button).toHaveClass("min-h-(--control-height-big)");
166
- expect(container.querySelectorAll("input, select, textarea")).toHaveLength(
167
- 0,
168
- );
169
- expect(screen.queryByRole("textbox")).toBeNull();
170
- expect(screen.queryByRole("spinbutton")).toBeNull();
171
- expect(container.textContent).not.toMatch(/card|expiry|cvc/i);
172
- });
173
-
174
- it("Pay now sends the piece to payForProposal; a failure shows the error line", async () => {
175
- const paySpy = jest.spyOn(actions, "payForProposal");
176
- mockPayArtifact.mockResolvedValue(refusal(502, "payment_unavailable"));
177
- render(<PayForm pieceId={PIECE} labels={LABELS} />);
178
- await act(async () => {
179
- fireEvent.click(screen.getByTestId("artifact-pay"));
180
- });
181
- expect(paySpy).toHaveBeenCalledTimes(1);
182
- expect((paySpy.mock.calls[0]![1] as FormData).get("pieceId")).toBe(PIECE);
183
- expect(mockPayArtifact).toHaveBeenCalledTimes(1);
184
- expect(mockPayArtifact).toHaveBeenCalledWith(PIECE, INIT);
185
- await waitFor(() =>
186
- expect(screen.getByTestId("artifact-pay-error")).toHaveTextContent(
187
- p.payError,
188
- ),
189
- );
190
- expect(mockRedirect).not.toHaveBeenCalled();
191
- paySpy.mockRestore();
192
- });
193
- });
@@ -1,476 +0,0 @@
1
- /**
2
- * The artifact review (#8234, spec 8234 D6, D7; AC-5, AC-6).
3
- *
4
- * Two layers:
5
- * - `submitArtifactReview` (the Server Action), with the api-client's
6
- * `member.reviewArtifact` as the one mocked boundary: the exact body it
7
- * posts for each verdict, the comment check before any call, each
8
- * refusal's reason, and logs that never carry the comment or the id.
9
- * - `ReviewForm` (the client form) over the real action, spied on to read
10
- * the `FormData` each button sends: the verdict and the comment, a
11
- * refusal that keeps the typed comment, and a sent review that refreshes
12
- * the page once.
13
- * - a proposal (#8516, spec
14
- * docs/specs/8516-proposals-as-an-artifact-kind-spec.md D19, AC-3, AC-4):
15
- * Approve proposal posts exactly what Approve posts; an approval whose
16
- * answered artifact owes a payment opens it through `member.payArtifact`
17
- * and redirects only to a Stripe Checkout URL — any other outcome is
18
- * `payment_failed`, with no redirect, and the form then offers Pay now.
19
- */
20
-
21
- import {
22
- act,
23
- fireEvent,
24
- render,
25
- screen,
26
- waitFor,
27
- } from "@testing-library/react";
28
-
29
- const mockReviewArtifact = jest.fn();
30
- const mockPayArtifact = jest.fn();
31
- jest.mock("@working-theory/api-client", () => ({
32
- __esModule: true,
33
- member: {
34
- reviewArtifact: (...args: unknown[]) => mockReviewArtifact(...args),
35
- payArtifact: (...args: unknown[]) => mockPayArtifact(...args),
36
- },
37
- }));
38
-
39
- jest.mock("next/headers", () => ({
40
- __esModule: true,
41
- headers: jest
42
- .fn()
43
- .mockResolvedValue(new Headers({ origin: "https://site.example.com" })),
44
- cookies: jest.fn().mockResolvedValue({ toString: () => "session=abc" }),
45
- }));
46
-
47
- const mockRefresh = jest.fn();
48
- // Next's `redirect()` throws NEXT_REDIRECT; the mock does too, so a catch
49
- // that swallowed it would show up as a resolved action.
50
- const mockRedirect = jest.fn((url: string): never => {
51
- throw new Error(`NEXT_REDIRECT ${url}`);
52
- });
53
- jest.mock("next/navigation", () => ({
54
- __esModule: true,
55
- useRouter: () => ({ push: jest.fn(), refresh: mockRefresh }),
56
- redirect: (url: string) => mockRedirect(url),
57
- }));
58
-
59
- import messages from "../../../../../../messages/en.json";
60
- import { type PayFormLabels } from "../[pieceId]/pay-form";
61
- import { ReviewForm, type ReviewFormLabels } from "../[pieceId]/review-form";
62
- import * as actions from "../artifact-actions";
63
- import { submitArtifactReview } from "../artifact-actions";
64
-
65
- const PIECE = "piece_01920000-0000-7000-8000-000000000001";
66
- const INIT = {
67
- headers: { cookie: "session=abc", origin: "https://site.example.com" },
68
- };
69
- const COMMENT = "Tighten the logo";
70
- const CHECKOUT = "https://checkout.stripe.com/c/pay/cs_test_x";
71
-
72
- function form(fields: Record<string, string>): FormData {
73
- const data = new FormData();
74
- for (const [key, value] of Object.entries(fields)) data.set(key, value);
75
- return data;
76
- }
77
-
78
- function review(
79
- fields: Partial<Record<"pieceId" | "version" | "review" | "comment", string>>,
80
- ) {
81
- return submitArtifactReview(
82
- { kind: "idle" },
83
- form({
84
- pieceId: PIECE,
85
- version: "3",
86
- review: "approved",
87
- comment: "",
88
- ...fields,
89
- }),
90
- );
91
- }
92
-
93
- function refusal(status: number, code: string) {
94
- return {
95
- ok: false,
96
- status,
97
- body: { ok: false, error: { code, message: "x" } },
98
- };
99
- }
100
-
101
- let errorSpy: jest.SpyInstance;
102
-
103
- beforeEach(() => {
104
- mockReviewArtifact
105
- .mockReset()
106
- .mockResolvedValue({ ok: true, body: { artifact: {} } });
107
- mockPayArtifact.mockReset().mockResolvedValue({
108
- ok: true,
109
- body: { url: CHECKOUT },
110
- });
111
- mockRedirect.mockClear();
112
- mockRefresh.mockReset();
113
- errorSpy = jest.spyOn(console, "error").mockImplementation(() => undefined);
114
- });
115
-
116
- afterEach(() => {
117
- errorSpy.mockRestore();
118
- });
119
-
120
- describe("submitArtifactReview (D6, AC-5)", () => {
121
- it("Approve posts { version, review } once with the caller's init and answers reviewed", async () => {
122
- await expect(review({})).resolves.toEqual({ kind: "reviewed" });
123
- expect(mockReviewArtifact).toHaveBeenCalledTimes(1);
124
- expect(mockReviewArtifact).toHaveBeenCalledWith(
125
- PIECE,
126
- { version: 3, review: "approved" },
127
- INIT,
128
- );
129
- });
130
-
131
- it("Request changes posts the trimmed comment and no other key", async () => {
132
- await expect(
133
- review({ review: "changes-requested", comment: ` ${COMMENT} ` }),
134
- ).resolves.toEqual({ kind: "reviewed" });
135
- expect(mockReviewArtifact).toHaveBeenCalledTimes(1);
136
- expect(mockReviewArtifact.mock.calls[0]![1]).toStrictEqual({
137
- version: 3,
138
- review: "changes-requested",
139
- comment: COMMENT,
140
- });
141
- });
142
-
143
- it("an Approve with a comment carries it", async () => {
144
- await review({ comment: "Lovely" });
145
- expect(mockReviewArtifact.mock.calls[0]![1]).toStrictEqual({
146
- version: 3,
147
- review: "approved",
148
- comment: "Lovely",
149
- });
150
- });
151
-
152
- it.each(["", " "])(
153
- "Request changes with a blank comment (%j) is comment_required with no call",
154
- async (comment) => {
155
- await expect(
156
- review({ review: "changes-requested", comment }),
157
- ).resolves.toEqual({
158
- kind: "error",
159
- reason: "comment_required",
160
- });
161
- expect(mockReviewArtifact).not.toHaveBeenCalled();
162
- },
163
- );
164
-
165
- it("Request changes with a comment the server would strip to nothing is comment_required with no call", async () => {
166
- await expect(
167
- review({ review: "changes-requested", comment: "\u200e\u202e" }),
168
- ).resolves.toEqual({ kind: "error", reason: "comment_required" });
169
- expect(mockReviewArtifact).not.toHaveBeenCalled();
170
- });
171
-
172
- it.each([
173
- ["a malformed piece id", { pieceId: "x" }],
174
- ["a version that is not a whole number", { version: "abc" }],
175
- ["an unknown verdict", { review: "rejected" }],
176
- ])("%s is failed with no call", async (_case, fields) => {
177
- await expect(review(fields)).resolves.toEqual({
178
- kind: "error",
179
- reason: "failed",
180
- });
181
- expect(mockReviewArtifact).not.toHaveBeenCalled();
182
- });
183
-
184
- it.each([
185
- ["review_closed", refusal(409, "review_closed"), "closed"],
186
- ["version_not_latest", refusal(409, "version_not_latest"), "not_latest"],
187
- ["too_many_requests", refusal(429, "too_many_requests"), "rate_limited"],
188
- ["a 429 rate_limited", refusal(429, "rate_limited"), "rate_limited"],
189
- ["invalid_input (400)", refusal(400, "invalid_input"), "failed"],
190
- ["a status-0 refusal", refusal(0, "unauthorized"), "failed"],
191
- ])("a %s refusal is %s", async (_case, res, reason) => {
192
- mockReviewArtifact.mockResolvedValue(res);
193
- await expect(
194
- review({ review: "changes-requested", comment: COMMENT }),
195
- ).resolves.toEqual({
196
- kind: "error",
197
- reason,
198
- });
199
- expect(mockReviewArtifact).toHaveBeenCalledTimes(1);
200
- });
201
-
202
- it("a throw is failed, logged by err.name only — never the comment or the piece id", async () => {
203
- mockReviewArtifact.mockRejectedValue(
204
- new TypeError(`fetch failed ${COMMENT} ${PIECE}`),
205
- );
206
- await expect(
207
- review({ review: "changes-requested", comment: COMMENT }),
208
- ).resolves.toEqual({
209
- kind: "error",
210
- reason: "failed",
211
- });
212
- expect(mockReviewArtifact).toHaveBeenCalledTimes(1);
213
- expect(errorSpy).toHaveBeenCalledWith(
214
- "[account] review failed errName=TypeError",
215
- );
216
- const logged = JSON.stringify(errorSpy.mock.calls);
217
- expect(logged).not.toContain(COMMENT);
218
- expect(logged).not.toContain(PIECE);
219
- });
220
- });
221
-
222
- /** The review's answer: the artifact as reviewed, with its payment state. */
223
- function answered(payment: unknown) {
224
- return {
225
- ok: true,
226
- body: {
227
- artifact: {
228
- id: PIECE,
229
- title: "Site redesign",
230
- approvedAt: "2026-10-05T09:00:00.000Z",
231
- kind: "proposal",
232
- price: { amount: 120000, currency: "usd" },
233
- payment,
234
- versions: [],
235
- },
236
- },
237
- };
238
- }
239
-
240
- describe("submitArtifactReview on a proposal (#8516 D19, AC-3, AC-4)", () => {
241
- it("Approve proposal posts { version, review: approved } once through member.reviewArtifact, exactly as Approve does", async () => {
242
- mockReviewArtifact.mockResolvedValue(answered(null));
243
- await expect(review({})).resolves.toEqual({ kind: "reviewed" });
244
- expect(mockReviewArtifact).toHaveBeenCalledTimes(1);
245
- expect(mockReviewArtifact).toHaveBeenCalledWith(
246
- PIECE,
247
- { version: 3, review: "approved" },
248
- INIT,
249
- );
250
- expect(mockPayArtifact).not.toHaveBeenCalled();
251
- expect(mockRedirect).not.toHaveBeenCalled();
252
- });
253
-
254
- it("an approval whose answered artifact is due calls member.payArtifact once and redirects to the Checkout URL", async () => {
255
- mockReviewArtifact.mockResolvedValue(answered({ status: "due" }));
256
- await expect(review({})).rejects.toThrow("NEXT_REDIRECT");
257
- expect(mockReviewArtifact).toHaveBeenCalledTimes(1);
258
- expect(mockPayArtifact).toHaveBeenCalledTimes(1);
259
- expect(mockPayArtifact).toHaveBeenCalledWith(PIECE, INIT);
260
- expect(mockRedirect).toHaveBeenCalledTimes(1);
261
- expect(mockRedirect).toHaveBeenCalledWith(CHECKOUT);
262
- });
263
-
264
- it.each([
265
- ["a payArtifact refusal", refusal(409, "proposal_not_approved")],
266
- ["a 404 (no payment surface)", refusal(404, "not_found")],
267
- [
268
- "a URL on another host",
269
- { ok: true, body: { url: "https://evil.example/x" } },
270
- ],
271
- [
272
- "a look-alike Stripe host",
273
- { ok: true, body: { url: "https://checkout.stripe.com.evil.example/x" } },
274
- ],
275
- [
276
- "a plain-http Checkout URL",
277
- { ok: true, body: { url: "http://checkout.stripe.com/x" } },
278
- ],
279
- ])(
280
- "%s after a due approval is payment_failed with no redirect",
281
- async (_case, res) => {
282
- mockReviewArtifact.mockResolvedValue(answered({ status: "due" }));
283
- mockPayArtifact.mockResolvedValue(res);
284
- await expect(review({})).resolves.toEqual({
285
- kind: "error",
286
- reason: "payment_failed",
287
- });
288
- expect(mockReviewArtifact).toHaveBeenCalledTimes(1);
289
- expect(mockPayArtifact).toHaveBeenCalledTimes(1);
290
- expect(mockRedirect).not.toHaveBeenCalled();
291
- },
292
- );
293
-
294
- it("a payArtifact throw is payment_failed, logged by err.name only — never the URL", async () => {
295
- mockReviewArtifact.mockResolvedValue(answered({ status: "due" }));
296
- mockPayArtifact.mockRejectedValue(
297
- new TypeError(`fetch failed ${CHECKOUT}`),
298
- );
299
- await expect(review({})).resolves.toEqual({
300
- kind: "error",
301
- reason: "payment_failed",
302
- });
303
- expect(mockRedirect).not.toHaveBeenCalled();
304
- expect(errorSpy).toHaveBeenCalledWith(
305
- "[account] payment failed errName=TypeError",
306
- );
307
- expect(JSON.stringify(errorSpy.mock.calls)).not.toContain(CHECKOUT);
308
- });
309
-
310
- it.each([
311
- ["paid", { status: "paid", paidAt: "2026-10-06T09:30:00.000Z" }],
312
- ["no payment surface", null],
313
- ])("an approval answered %s opens no payment", async (_case, payment) => {
314
- mockReviewArtifact.mockResolvedValue(answered(payment));
315
- await expect(review({})).resolves.toEqual({ kind: "reviewed" });
316
- expect(mockPayArtifact).not.toHaveBeenCalled();
317
- expect(mockRedirect).not.toHaveBeenCalled();
318
- });
319
-
320
- it("a changes-requested review never opens a payment", async () => {
321
- mockReviewArtifact.mockResolvedValue(answered({ status: "due" }));
322
- await expect(
323
- review({ review: "changes-requested", comment: COMMENT }),
324
- ).resolves.toEqual({ kind: "reviewed" });
325
- expect(mockPayArtifact).not.toHaveBeenCalled();
326
- expect(mockRedirect).not.toHaveBeenCalled();
327
- });
328
- });
329
-
330
- const r = messages.account.artifacts.review;
331
- const p = messages.account.artifacts.proposal;
332
- const LABELS: ReviewFormLabels = {
333
- heading: r.heading.replace("{version}", "3"),
334
- comment: r.comment,
335
- commentHint: r.commentHint,
336
- approve: r.approve,
337
- requestChanges: r.requestChanges,
338
- submitting: r.submitting,
339
- sent: r.sent,
340
- errors: {
341
- comment_required: r.errors.commentRequired,
342
- closed: r.errors.closed,
343
- not_latest: r.errors.notLatest,
344
- rate_limited: r.errors.rateLimited,
345
- failed: r.errors.failed,
346
- payment_failed: p.payError,
347
- },
348
- };
349
- const PAY_LABELS: PayFormLabels = {
350
- pay: p.pay,
351
- paying: p.paying,
352
- error: p.payError,
353
- };
354
-
355
- describe("ReviewForm (D7, AC-6)", () => {
356
- // A pass-through spy: the real action runs; the spy reads what it was sent.
357
- let submitSpy: jest.SpyInstance;
358
-
359
- beforeEach(() => {
360
- submitSpy = jest.spyOn(actions, "submitArtifactReview");
361
- render(<ReviewForm pieceId={PIECE} version={3} labels={LABELS} />);
362
- });
363
-
364
- afterEach(() => {
365
- submitSpy.mockRestore();
366
- });
367
-
368
- function sent(): FormData {
369
- expect(submitSpy).toHaveBeenCalledTimes(1);
370
- return submitSpy.mock.calls[0]![1] as FormData;
371
- }
372
-
373
- it("Request changes sends the verdict, the comment, the piece and the version; a refusal shows its message and keeps the comment", async () => {
374
- mockReviewArtifact.mockResolvedValue(refusal(409, "review_closed"));
375
- fireEvent.change(screen.getByTestId("artifact-review-comment"), {
376
- target: { value: COMMENT },
377
- });
378
- await act(async () => {
379
- fireEvent.click(screen.getByTestId("artifact-review-request-changes"));
380
- });
381
- const data = sent();
382
- expect(data.get("review")).toBe("changes-requested");
383
- expect(data.get("comment")).toBe(COMMENT);
384
- expect(data.get("pieceId")).toBe(PIECE);
385
- expect(data.get("version")).toBe("3");
386
- await waitFor(() =>
387
- expect(screen.getByTestId("artifact-review-error")).toHaveTextContent(
388
- "This version can't be reviewed now. It may already be approved.",
389
- ),
390
- );
391
- expect(screen.getByTestId("artifact-review-comment")).toHaveValue(COMMENT);
392
- expect(mockRefresh).not.toHaveBeenCalled();
393
- });
394
-
395
- it("Approve sends the approved verdict; a sent review shows the thanks line and refreshes once", async () => {
396
- await act(async () => {
397
- fireEvent.click(screen.getByTestId("artifact-review-approve"));
398
- });
399
- expect(sent().get("review")).toBe("approved");
400
- expect(mockReviewArtifact).toHaveBeenCalledWith(
401
- PIECE,
402
- { version: 3, review: "approved" },
403
- INIT,
404
- );
405
- await waitFor(() =>
406
- expect(screen.getByTestId("artifact-review-sent")).toHaveTextContent(
407
- "Thanks — your review was sent.",
408
- ),
409
- );
410
- expect(mockRefresh).toHaveBeenCalledTimes(1);
411
- });
412
-
413
- it("labels the comment box, and gives both buttons a 44px phone target", () => {
414
- expect(screen.getByLabelText("Comment")).toBe(
415
- screen.getByTestId("artifact-review-comment"),
416
- );
417
- expect(screen.getByTestId("artifact-review-approve")).toHaveClass(
418
- "max-md:min-h-11",
419
- );
420
- expect(screen.getByTestId("artifact-review-request-changes")).toHaveClass(
421
- "max-md:min-h-11",
422
- );
423
- });
424
- });
425
-
426
- describe("ReviewForm on a proposal (#8516 D19, AC-3)", () => {
427
- const PROPOSAL_LABELS: ReviewFormLabels = {
428
- ...LABELS,
429
- heading: p.heading.replace("{version}", "1"),
430
- approve: p.approve,
431
- };
432
-
433
- it("labels the decision by prop: Your decision on version <n>, Approve proposal, Request changes", () => {
434
- render(
435
- <ReviewForm
436
- pieceId={PIECE}
437
- version={1}
438
- labels={PROPOSAL_LABELS}
439
- pay={PAY_LABELS}
440
- />,
441
- );
442
- expect(screen.getByRole("heading", { level: 3 })).toHaveTextContent(
443
- "Your decision on version 1",
444
- );
445
- expect(screen.getByTestId("artifact-review-approve")).toHaveTextContent(
446
- "Approve proposal",
447
- );
448
- expect(
449
- screen.getByTestId("artifact-review-request-changes"),
450
- ).toHaveTextContent("Request changes");
451
- });
452
-
453
- it("an approval whose payment could not open shows the error and offers Pay now in the form's place", async () => {
454
- mockReviewArtifact.mockResolvedValue(answered({ status: "due" }));
455
- mockPayArtifact.mockResolvedValue(refusal(502, "payment_unavailable"));
456
- render(
457
- <ReviewForm
458
- pieceId={PIECE}
459
- version={3}
460
- labels={PROPOSAL_LABELS}
461
- pay={PAY_LABELS}
462
- />,
463
- );
464
- await act(async () => {
465
- fireEvent.click(screen.getByTestId("artifact-review-approve"));
466
- });
467
- await waitFor(() =>
468
- expect(screen.getByTestId("artifact-review-error")).toHaveTextContent(
469
- p.payError,
470
- ),
471
- );
472
- expect(screen.getByTestId("artifact-pay")).toHaveTextContent("Pay now");
473
- expect(screen.queryByTestId("artifact-review-approve")).toBeNull();
474
- expect(mockRedirect).not.toHaveBeenCalled();
475
- });
476
- });