From 6ed50d1c80aab6d1abf75cb90978044f8becbc83 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 3 May 2024 18:39:10 -0700 Subject: [PATCH] e2e-tests: Fix implicit use of any. Signed-off-by: Anders Kaseorg --- web/e2e-tests/realm-creation.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/e2e-tests/realm-creation.test.ts b/web/e2e-tests/realm-creation.test.ts index ee2d4253c0..9fa51d7928 100644 --- a/web/e2e-tests/realm-creation.test.ts +++ b/web/e2e-tests/realm-creation.test.ts @@ -1,6 +1,7 @@ import {strict as assert} from "assert"; import type {Page} from "puppeteer"; +import {z} from "zod"; import * as common from "./lib/common"; @@ -34,7 +35,10 @@ async function realm_creation_tests(page: Page): Promise { // Open the confirmation URL const page_content = await page.evaluate(() => document.querySelector("body")!.textContent); - const confirmation_key: string = JSON.parse(page_content!).confirmation_key; + assert(page_content !== null); + const {confirmation_key} = z + .object({confirmation_key: z.string()}) + .parse(JSON.parse(page_content)); const confirmation_url = `http://${host}/accounts/do_confirm/${confirmation_key}`; await page.goto(confirmation_url);