fix: remediate branch review findings

This commit is contained in:
Josh Creek
2026-09-14 11:47:58 +01:00
parent 4af33709a3
commit 86f1c21e4d
38 changed files with 65833 additions and 58545 deletions
-28
View File
@@ -43,34 +43,6 @@ export async function deleteAllPokedexes(state: ScenarioState): Promise<void> {
if (!response.ok) throw new Error(`Unable to clear Pokédexes: ${await response.text()}`);
}
/**
* Asks Supabase for a real recovery action link - the same token-bearing URL the emailed link
* carries - so the reset scenarios exercise token verification rather than an ordinary session.
* `redirectTo` must be listed in `auth.additional_redirect_urls` in supabase/config.toml.
*/
export async function createRecoveryLink(
state: ScenarioState,
redirectTo: string
): Promise<string> {
const key = requireServiceRoleKey();
const response = await fetch(`${SUPABASE_URL}/auth/v1/admin/generate_link`, {
method: 'POST',
headers: {
apikey: key,
Authorization: `Bearer ${key}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ type: 'recovery', email: state.email, redirect_to: redirectTo })
});
if (!response.ok)
throw new Error(
`Unable to generate a recovery link: ${response.status} ${await response.text()}`
);
const body = (await response.json()) as { action_link?: string };
if (!body.action_link) throw new Error('Supabase returned no recovery action link');
return body.action_link;
}
export async function signIn(page: Page, state: ScenarioState, password = state.password) {
await page.goto('/signin');
await page.getByLabel('Email').fill(state.email);