Files
orca/src/shared/uuid-v4.test.ts
T
OrcaWin 82412dab8b Persist profile state in SQLite with background writes (#22612)
Migrate profile state to SQLite and move writes and backups into a background worker. Acknowledge terminal, SSH and automation changes only after durable saves. Preserve JSON import, recovery, rollback and compatibility exports.

Validate migration, worker failures, maintenance, cross-profile moves and terminal lifetime races with unit, integration and end-to-end coverage.
2026-09-25 22:47:33 -07:00

26 lines
697 B
TypeScript

import { afterEach, describe, expect, it, vi } from 'vitest'
import { createUuidV4 } from './uuid-v4'
const UUID_V4 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/
describe('createUuidV4', () => {
afterEach(() => vi.unstubAllGlobals())
it('uses the browser crypto fallback when randomUUID is unavailable', () => {
vi.stubGlobal('crypto', {
getRandomValues: (bytes: Uint8Array) => {
bytes.fill(0xab)
return bytes
}
})
expect(createUuidV4()).toMatch(UUID_V4)
})
it('still returns a UUID when Web Crypto is unavailable', () => {
vi.stubGlobal('crypto', undefined)
expect(createUuidV4()).toMatch(UUID_V4)
})
})