1import { describe, expect, it } from "vite-plus/test";
2
3import { secretRequestPageUrl } from "./secretRequest.ts";
4
5describe("secretRequestPageUrl", () => {
6 it("opens only http and https pages", () => {
7 expect(secretRequestPageUrl("https://accounts.google.com/o/oauth2/auth?x=1")?.host).toBe(
8 "accounts.google.com",
9 );
10 expect(secretRequestPageUrl("javascript:alert(1)")).toBeNull();
11 expect(secretRequestPageUrl("https://?state=x")).toBeNull();
12 expect(secretRequestPageUrl("not a url")).toBeNull();
13 });
14});