test(native): fix the sign-in handoff tests' quoting and formatting

This commit is contained in:
Maurice
2026-11-09 23:15:09 +01:00
parent 1cdde6e9a4
commit 8dd2e9716d
4 changed files with 13 additions and 4 deletions
+3 -1
View File
@@ -47,7 +47,9 @@ describe('handoffUrl', () => {
it('starts at the server page in front of the hand-off page, with the challenge and an optional start', () => {
// Under /api, which every TREK service worker passes to the server: an older
// version's worker must not answer the hand-off page from its cache.
expect(handoffUrl('https://trek.example.com', 'c')).toBe('https://trek.example.com/api/auth/native/start?challenge=c');
expect(handoffUrl('https://trek.example.com', 'c')).toBe(
'https://trek.example.com/api/auth/native/start?challenge=c'
);
expect(handoffUrl('https://trek.example.com', 'c', 'oidc')).toBe(
'https://trek.example.com/api/auth/native/start?challenge=c&start=oidc'
);
+6 -1
View File
@@ -1,5 +1,10 @@
import { afterEach, describe, expect, it } from 'vitest';
import { BROWSER_SIGN_IN_KEY, BROWSER_SIGN_IN_TTL_MS, browserSignInRunning, endBrowserSignIn } from './browserSignInFlag';
import {
BROWSER_SIGN_IN_KEY,
BROWSER_SIGN_IN_TTL_MS,
browserSignInRunning,
endBrowserSignIn,
} from './browserSignInFlag';
afterEach(() => localStorage.clear());
+1 -1
View File
@@ -447,7 +447,7 @@ describe('reconcileAppVersion: a page loaded past an older worker', () => {
})
})
describe('reconcileAppVersion: during the app's sign-in in the browser', () => {
describe("reconcileAppVersion: during the app's sign-in in the browser", () => {
it('FE-UTIL-VERSION-058: leaves version and page alone while the sign-in runs, and acts again after it', async () => {
const { container } = installWorker(null)
container.getRegistration.mockResolvedValue(undefined)
@@ -140,7 +140,9 @@ describe('NativeAuthController.start', () => {
it('NATIVE-CTL-009: the page loads the forwarding script from the server and escapes the target', () => {
const page = nativeStartPage('/native-handoff?challenge=a&start=oidc');
expect(page).toContain('<script src="/native-handoff.js" data-target="/native-handoff?challenge=a&amp;start=oidc"></script>');
expect(page).toContain(
'<script src="/native-handoff.js" data-target="/native-handoff?challenge=a&amp;start=oidc"></script>',
);
expect(page).toContain('<meta http-equiv="refresh" content="0;url=/native-handoff?challenge=a&amp;start=oidc">');
expect(nativeStartPage('/native-handoff?x="<>')).not.toMatch(/"<>/);
});