import { createHtmlMessageNonce, createHtmlMessageDocument } from '../pages/index/HtmlMessage.js'; afterEach(() => vi.unstubAllGlobals()); it('creates a nonce without secure-context-only randomUUID', () => { const getRandomValues = vi.fn((bytes: Uint8Array) => bytes.fill(7)); vi.stubGlobal('crypto', { getRandomValues }); const nonce = createHtmlMessageNonce(); expect(getRandomValues).toHaveBeenCalledTimes(1); expect(nonce).toBe('07'.repeat(16)); expect(createHtmlMessageDocument('content', nonce)).toContain(`nonce-${nonce}`); }); it('installs the trusted reporter before raw content including unfinished script tags', () => { const html = '