// Consumer fixture for mirza-rizvi/shelf commit // 50dd9321b8639c6fd5f3bd247ecb6fdfdf9f2229 (MIT). // Place in lib/importExport/, remove the final .txt suffix, and run with Vitest. import { expect, it } from 'vitest'; import { DEFAULT_SETTINGS } from '../constants'; import { buildJsonExport } from './exportJson'; import { parseJsonImport } from './importJson'; import type { SavedGroup } from '../types'; it('restores exported settings during a full backup round trip', () => { const group: SavedGroup = { id: 'source-group', name: 'Portability control', createdAt: 1, updatedAt: 2, chromeGroups: [], tabs: [{ id: 'source-tab', url: 'https://example.com/', title: 'Example', pinned: false, savedAt: 3, chromeGroupIdx: null, }], }; const settings = { ...DEFAULT_SETTINGS, theme: 'dark' as const, restoreInNewWindow: true, excludedDomains: ['mail.example.com'], tabLimit: { enabled: true, maxTabs: 17 }, }; const exported = buildJsonExport([group], settings); expect(JSON.parse(exported).settings).toEqual(settings); const imported = parseJsonImport(exported) as ReturnType & { settings?: typeof settings; }; expect(imported.settings).toEqual(settings); });