Files
iofficeai--aionui/tests/unit/preview/previewToolbarUtils.test.ts
2026-07-13 13:20:22 +08:00

22 lines
893 B
TypeScript

import { describe, expect, it } from 'vitest';
import { shouldShowDownload } from '@renderer/pages/conversation/Preview/components/PreviewPanel/previewToolbarUtils';
describe('shouldShowDownload', () => {
it('hides download for on-disk code files', () => {
expect(shouldShowDownload('code', true)).toBe(false);
});
it('hides download for on-disk markdown files', () => {
expect(shouldShowDownload('markdown', true)).toBe(false);
});
it('shows download for synthetic (no file_path) markdown', () => {
expect(shouldShowDownload('markdown', false)).toBe(true);
});
it('shows download for code without a backing file', () => {
expect(shouldShowDownload('code', false)).toBe(true);
});
it('shows download for other content types', () => {
expect(shouldShowDownload('html', true)).toBe(true);
expect(shouldShowDownload('diff', true)).toBe(true);
});
});