Files
deepseek-harness/packages/client/ui-sidebar-documentpreview/tests/document-unviewable.client.spec.ts
T
Yif f51addaa0d fix(web-sidebar): resolve review feedback on document preview polish
- files tree records its scroll offset in a ref and commits it once on
  unmount, only while the owner's signal is live, so a scroll neither
  re-renders the tree nor writes to a forgotten bucket
- LoadingIndicator drops iconOnly and always renders icon-only
- registry and the unviewable list share one suffix-matching module, and
  register() rejects binaryExtensions entries outside extensions
- drop the ambiguous key suffix from the unviewable office group
- extract the text preview's header path block shared by the unsupported
  and content branches; clsx for static class joins; CSS trailing newline
- sync the preview-operations and polish Agent Notes with shipped facts
2026-09-14 18:06:23 +08:00

26 lines
1.1 KiB
TypeScript

// @vitest-environment jsdom
import { describe, expect, it } from 'vitest'
import { unviewableBinaryPath } from '../src/client/document/unviewable.ts'
describe('unviewableBinaryPath', () => {
it('matches one sample from every listed category', () => {
for (const path of [
'clip.mp4', 'song.mp3', 'bundle.zip', 'report.docx', 'tool.exe',
'face.woff2', 'image.dmg', 'design.psd',
]) expect(unviewableBinaryPath(path), path).toBe(true)
})
it('matches regardless of case, directories, and path separators', () => {
expect(unviewableBinaryPath('MOVIE.MP4')).toBe(true)
expect(unviewableBinaryPath('work/deep/archive.tar.gz')).toBe(true)
expect(unviewableBinaryPath('work\\deep\\notes.docx')).toBe(true)
})
it('leaves renderer-claimed, text, and unknown suffixes to their existing paths', () => {
for (const path of [
'main.ts', 'README.md', 'photo.png', 'page.html', 'paper.pdf', 'logo.svg',
'server.log', 'config.env', 'notes.unknown', 'Makefile', 'mp4', 'private.key',
]) expect(unviewableBinaryPath(path), path).toBe(false)
})
})