Download packages/core/test/oauth-page.test.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 667 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/core/test/oauth-page.test.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/core/test/oauth-page.test.ts
-
curl -L -o oauth-page.test.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/core/test/oauth-page.test.ts
667 Bytes
| import { describe, expect, test } from "bun:test" | |
| import { OauthCallbackPage } from "../src/oauth/page" | |
| describe("OauthCallbackPage", () => { | |
| test("escapes bootstrap options embedded in the inline script", () => { | |
| const html = OauthCallbackPage.bootstrap({ | |
| provider: `xAI</script><script>alert("provider")</script>`, | |
| tokenPath: `/token</script><script>alert("path")</script>`, | |
| }) | |
| expect(html.match(/<\/script>/g)).toHaveLength(1) | |
| expect(html).toContain(`xAI\\u003c/script>\\u003cscript>alert(\\\"provider\\\")\\u003c/script>`) | |
| expect(html).toContain(`/token\\u003c/script>\\u003cscript>alert(\\\"path\\\")\\u003c/script>`) | |
| }) | |
| }) | |