MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / fetchResetToken

Function fetchResetToken

apps/ui/e2e/password-reset.spec.ts:16–41  ·  view source on GitHub ↗
(email: string)

Source from the content-addressed store, hash-verified

14const NEW_PASSWORD = "BrandNewPwd456!";
15
16async function fetchResetToken(email: string): Promise<string> {
17 const ctx = await request.newContext({ baseURL: E2E_API_BASE_URL });
18 const res = await ctx.post("/api/v1/auth/__test/issue-reset-token", {
19 data: { email }
20 });
21
22 if (!res.ok()) {
23 throw new Error(
24 `issue-reset-token failed (${String(res.status())}): ${await res.text()}`
25 );
26 }
27
28 const body = await parseBody(
29 res,
30 z.object({ data: z.object({ token: z.string().optional() }).optional() })
31 );
32 const token = body.data?.token;
33
34 await ctx.dispose();
35
36 if (typeof token !== "string" || token === "") {
37 throw new Error("expected raw reset token in response");
38 }
39
40 return token;
41}
42
43test.describe("Password reset", () => {
44 /*

Callers 1

Calls 1

parseBodyFunction · 0.90

Tested by

no test coverage detected