import { describe, expect, it } from 'vitest'; import type { WorkbenchView } from '../src/api/workbench'; import { normalizeWorkbench } from '../src/api/workbench'; import { parseWorkbenchTarget } from '../src/pages/workbench/workbench-navigation'; describe('workbench R3 contracts', () => { it('normalizes every optional workbench collection to an array', () => { expect( normalizeWorkbench({ title: '资料管理工作台', archiveItems: null, activities: undefined, } as unknown as Partial), ).toMatchObject({ title: '资料管理工作台', metrics: [], todos: [], projects: [], issues: [], funds: [], archiveItems: [], activities: [], }); }); it('keeps download drilldowns within the archive file allowlist', () => { expect(parseWorkbenchTarget('/archives/files')).toEqual({ path: '/archives/files' }); expect(parseWorkbenchTarget('/archives/files?token=SECRET')).toEqual({ path: '/archives/files', }); }); });