(cookie: string)
| 33 | |
| 34 | /** Read all cookie pairs, including admin verification, into browser fixtures. */ |
| 35 | export const browserCookies = (cookie: string): NonNullable<Identity["cookies"]> => |
| 36 | cookie |
| 37 | .split(";") |
| 38 | .map((pair) => pair.trim()) |
| 39 | .filter(Boolean) |
| 40 | .map((pair) => { |
| 41 | const separator = pair.indexOf("="); |
| 42 | if (separator < 1) throw new Error("Invalid test cookie"); |
| 43 | const name = pair.slice(0, separator); |
| 44 | return { |
| 45 | name, |
| 46 | value: pair.slice(separator + 1), |
| 47 | ...(name.startsWith("__Host-") ? { secure: true } : {}), |
| 48 | }; |
| 49 | }); |
| 50 | |
| 51 | /** Verify a test admin through the product, retaining the test authenticator for later sign-ins. */ |
| 52 | export const verifyAdmin = (baseUrl: string, identity: Identity): Effect.Effect<Identity> => |
no outgoing calls
no test coverage detected