Golden-master tests pinning the CURRENT behavior of high-value modules that had no coverage — integration seams, security helpers, two API route handlers, and complex pure utils. 111 tests across 12 files. New tests: - auth-crypto / session-cookie: AES-256-GCM session encryption roundtrip, tamper/version/missing-secret handling; cookie-slot naming. - unified-mailbox: multi-account fan-out, sort, totals, per-account error isolation, personal-vs-shared JMAP target resolution, counts/roles. - account-state-manager: snapshot/restore across the six real Zustand stores; clearAllStores reset shape; evict. - mdn: RFC 5322 MDN assembly (CRLF, RFC2047, base64 wrap, headers). - tnef: winmail.dat binary parsing from hand-built fixtures. - download-filename / subject-prefix / birthday-calendar / eml-import: filename templating, multilingual prefix stripping, birthday event generation, .eml/.zip import. - webdav / caldav-discover route handlers: auth guards, path validation, upstream URL construction, candidate probing. - helpers/factories.ts: shared makeEmail/makeMailbox/makeFakeJmapClient. Tests follow the repo's existing patterns (route-import, fake IJMAPClient, fetch spy, real store singletons). Where current behavior looks buggy it is pinned and flagged with a // CHARACTERISATION: comment (see PR for the suspected-bugs list); no production code is changed.
23 lines
694 B
TypeScript
23 lines
694 B
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import {
|
|
SESSION_COOKIE,
|
|
SESSION_COOKIE_MAX_AGE,
|
|
sessionCookieName,
|
|
} from '@/lib/auth/session-cookie';
|
|
|
|
describe('session-cookie', () => {
|
|
it('exposes the legacy cookie name and 30-day max-age', () => {
|
|
expect(SESSION_COOKIE).toBe('jmap_session');
|
|
expect(SESSION_COOKIE_MAX_AGE).toBe(2592000); // 30 * 24 * 60 * 60
|
|
});
|
|
|
|
it('uses the bare legacy name for slot 0 (no suffix)', () => {
|
|
expect(sessionCookieName(0)).toBe('jmap_session');
|
|
});
|
|
|
|
it('suffixes the slot number for slots > 0', () => {
|
|
expect(sessionCookieName(1)).toBe('jmap_session_1');
|
|
expect(sessionCookieName(49)).toBe('jmap_session_49');
|
|
});
|
|
});
|