144 files moved with git mv (pure renames). Root package.json delegates dev/typecheck/test:run/lint/build to the packages; Node 24 LTS and pnpm 10.13.1 pinned (.nvmrc, .node-version, engines, packageManager, root devDependency, engine-strict). Dockerfile builds @faunosteo/app on node:24-alpine and copies apps/app/dist; nginx and runtime config unchanged. CI workflow for Gitea Actions. packages/ reserved (README only). Docs synced: WORKSPACE.md, CLAUDE.md, README, DEPLOY, CHANGELOG, plan. 271/271 tests, typecheck, lint, build green from the root.
34 lines
955 B
TypeScript
34 lines
955 B
TypeScript
import { describe, it, expect, beforeEach } from 'vitest'
|
|
import {
|
|
readCachedPractitioner,
|
|
writeCachedPractitioner,
|
|
clearPractitionerCache,
|
|
} from '@/state/practitionerCache'
|
|
|
|
beforeEach(() => localStorage.clear())
|
|
|
|
describe('practitionerCache', () => {
|
|
it('returns undefined when empty', () => {
|
|
expect(readCachedPractitioner()).toBeUndefined()
|
|
})
|
|
|
|
it('round-trips a valid practitioner', () => {
|
|
writeCachedPractitioner({ name: 'Dr. Dupont', cabinet: 'Clinic A' })
|
|
expect(readCachedPractitioner()).toEqual({
|
|
name: 'Dr. Dupont',
|
|
cabinet: 'Clinic A',
|
|
})
|
|
})
|
|
|
|
it('returns undefined on malformed JSON', () => {
|
|
localStorage.setItem('osteo:lastPractitioner', 'not-json')
|
|
expect(readCachedPractitioner()).toBeUndefined()
|
|
})
|
|
|
|
it('clear removes the entry', () => {
|
|
writeCachedPractitioner({ name: 'Dr. Dupont' })
|
|
clearPractitionerCache()
|
|
expect(readCachedPractitioner()).toBeUndefined()
|
|
})
|
|
})
|