Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

e2e-tests: Fix implicit use of any.

Anders Kaseorg6ed50d1c80aa
diff --git a/web/e2e-tests/realm-creation.test.ts b/web/e2e-tests/realm-creation.test.ts
index ee2d4253c0a..9fa51d79284 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<void> {
// 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);