Skip to content

A full-featured download manager.

test: prune low-value test cases

Dr_rOot10bdc7862b1b
diff --git a/src/core/engine/aria2/aria2-adapter.test.ts b/src/core/engine/aria2/aria2-adapter.test.ts
index 0b5b87ca..b20b4c6d 100644
--- a/src/core/engine/aria2/aria2-adapter.test.ts
+++ b/src/core/engine/aria2/aria2-adapter.test.ts
@@ -242,24 +242,6 @@ const RAW_FILES: Aria2RawFile[] = [
// ─── Tests ──────────────────────────────────────────────────
describe('Aria2Adapter', () => {
- describe('connect / disconnect', () => {
- it('delegates connect to rpc client', async () => {
- const rpc = createMockRpc()
- const adapter = new Aria2Adapter(rpc)
- await adapter.connect()
- // connect is a no-op on adapter — RPC connection is
- // managed by EngineSupervisor
- expect(true).toBe(true)
- })
-
- it('delegates disconnect to rpc client', async () => {
- const rpc = createMockRpc()
- const adapter = new Aria2Adapter(rpc)
- await adapter.disconnect()
- expect(true).toBe(true)
- })
- })
-
describe('getCapabilities / getFeatureReport', () => {
it('returns conservative defaults before connect()', () => {
const rpc = createMockRpc()
diff --git a/src/core/logger.test.ts b/src/core/logger.test.ts
index 76a298e9..8e2e7423 100644
--- a/src/core/logger.test.ts
+++ b/src/core/logger.test.ts
@@ -7,16 +7,6 @@ describe('logger', () => {
initLogger(pino({ level: 'silent' }))
})
- it('getLogger returns a pino child logger with module field', () => {
- const log = getLogger('engine')
- expect(log).toBeDefined()
- expect(typeof log.info).toBe('function')
- expect(typeof log.error).toBe('function')
- expect(typeof log.warn).toBe('function')
- expect(typeof log.debug).toBe('function')
- expect(typeof log.fatal).toBe('function')
- })
-
it('initLogger replaces the root logger', () => {
const mockInfo = vi.fn()
const mockChild = vi.fn().mockReturnValue({ info: mockInfo })
diff --git a/src/core/settings/tracker-settings.test.ts b/src/core/settings/tracker-settings.test.ts
index 1cb40047..d0f1dfb6 100644
--- a/src/core/settings/tracker-settings.test.ts
+++ b/src/core/settings/tracker-settings.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
-import { DEFAULT_TRACKER_SETTINGS, trackerSettingsSchema } from './validators'
+import { trackerSettingsSchema } from './validators'
describe('trackerSettingsSchema', () => {
it('provides defaults for empty input', () => {
@@ -45,10 +45,3 @@ describe('trackerSettingsSchema', () => {
expect(result.sourcesEnabled).toBe(false)
})
})
-
-describe('DEFAULT_TRACKER_SETTINGS', () => {
- it('is a valid TrackerSettings object', () => {
- expect(DEFAULT_TRACKER_SETTINGS.autoSync).toBe(true)
- expect(DEFAULT_TRACKER_SETTINGS.sources).toBeDefined()
- })
-})
diff --git a/src/core/task/create-task-handler.test.ts b/src/core/task/create-task-handler.test.ts
index 06226482..abcece8a 100644
--- a/src/core/task/create-task-handler.test.ts
+++ b/src/core/task/create-task-handler.test.ts
@@ -159,11 +159,9 @@ function makeDeps(overrides: DepOverrides = {}): Deps & {
const reserveEngineTaskId = vi.fn()
const releaseEngineTaskIdReservation = vi.fn(() => true)
const retireEngineTaskIdReservation = vi.fn(() => true)
- // Route the create path through a REAL Aria2Adapter wrapping mock rpc
- // spies. The characterization tests then inspect the SAME `addUri` /
- // `addTorrent` calls (the actual aria2 wire) the adapter emits — proving
- // byte-identity. The three `on*` subscriptions are required by the
- // Aria2Adapter constructor; they are no-op stubs here.
+ // Route the create path through a real Aria2Adapter wrapping mock RPC
+ // spies so handler tests cover the integration boundary. The three `on*`
+ // subscriptions are required by the constructor and are no-op stubs here.
const rpcClient = {
addUri,
addTorrent,
@@ -1669,277 +1667,6 @@ describe('handleCreateTask reserved-GID ownership', () => {
})
})
-// ─── Characterization: aria2 RPC args ────────────────────────────────────────
-//
-// These tests pin the EXACT wire arguments that reach rpcClient.addUri /
-// rpcClient.addTorrent today. They are the regression net for the whole
-// EngineAdapter refactor: they MUST keep passing byte-for-byte after every
-// subsequent task. Any drift in a key name, value string, or positional arg
-// must cause a failure here.
-
-describe('characterization: aria2 RPC args', () => {
- // (a) Plain HTTP: dir + out(.motrix) only, no header/proxy/split keys
- it('HTTP plain: dir=saveDir, out=basename.motrix, no header/proxy/split keys', async () => {
- const deps = makeDeps()
- await handleCreateTask(
- {
- type: 'http',
- uris: ['https://example.com/file.zip'],
- saveDir: '/dl',
- filename: 'file.zip',
- headers: [],
- },
- deps
- )
- expect(deps.addUri).toHaveBeenCalledOnce()
- const [uris, options] = deps.addUri.mock.calls[0] as [
- string[],
- Record<string, unknown>,
- ]
- expect(uris).toEqual(['https://example.com/file.zip'])
- expect(options.dir).toBe('/dl')
- expect(options.out).toBe('file.zip.motrix')
- // No connection keys when connections is absent
- expect(options.split).toBeUndefined()
- expect(options['max-connection-per-server']).toBeUndefined()
- // No header/proxy keys when not provided
- expect(options.header).toBeUndefined()
- expect(options['all-proxy']).toBeUndefined()
- })
-
- // (b) HTTP with headers + proxy + connections (clamped to the engine default)
- it('HTTP full: connections clamped to 64, header array, all-proxy, out=.motrix', async () => {
- const deps = makeDeps()
- await handleCreateTask(
- {
- type: 'http',
- uris: ['https://example.com/file.zip'],
- saveDir: '/dl',
- filename: 'file.zip',
- connections: 128, // clamped to maxConnectionPerServer=64
- headers: [{ name: 'Cookie', value: 'a=b' }],
- proxy: 'http://p:1080',
- },
- deps
- )
- expect(deps.addUri).toHaveBeenCalledOnce()
- const [uris, options] = deps.addUri.mock.calls[0] as [
- string[],
- Record<string, unknown>,
- ]
- expect(uris).toEqual(['https://example.com/file.zip'])
- expect(options.dir).toBe('/dl')
- expect(options.out).toBe('file.zip.motrix')
- // connections: min(128, 64) = 64, both keys identical string
- expect(options.split).toBe('64')
- expect(options['max-connection-per-server']).toBe('64')
- expect(options.split).toBe(options['max-connection-per-server'])
- expect(options.header).toEqual(['Cookie: a=b'])
- expect(options['all-proxy']).toBe('http://p:1080')
- })
-
- // (b-extra) HTTP with extraEngineOptions merged in after applyPathOverrides
- it('HTTP extraEngineOptions: referer and load-cookies land in addUri options', async () => {
- const deps = makeDeps()
- await handleCreateTask(
- {
- type: 'http',
- uris: ['https://example.com/video.mp4'],
- saveDir: '/dl',
- filename: 'video.mp4',
- headers: [],
- },
- deps,
- {
- extraEngineOptions: {
- referer: 'https://referrer.example',
- 'load-cookies': '/tmp/cookies.txt',
- },
- }
- )
- expect(deps.addUri).toHaveBeenCalledOnce()
- const [uris, options] = deps.addUri.mock.calls[0] as [
- string[],
- Record<string, unknown>,
- ]
- expect(uris).toEqual(['https://example.com/video.mp4'])
- expect(options.dir).toBe('/dl')
- expect(options.out).toBe('video.mp4.motrix')
- expect(options.referer).toBe('https://referrer.example')
- expect(options['load-cookies']).toBe('/tmp/cookies.txt')
- })
-
- // (c) HTTP rewritten by beforeCreate plugin chain
- it('HTTP plugin rewrite: rewritten uris/headers/proxy reach addUri', async () => {
- const staged = {
- commitMetadata: vi.fn((_db: unknown, _id: string, cb: () => void) => {
- cb()
- }),
- }
- const orchestrator = {
- runBeforeCreateHttp: vi.fn().mockResolvedValue({
- final: {
- type: 'http' as const,
- sourceUrl: 'https://original.example/file.zip',
- uris: ['https://cdn.example/file-rewritten.zip'],
- saveDir: '/dl',
- filename: 'file.zip',
- connections: undefined,
- headers: [
- { name: 'X-Token', value: 'secret' },
- { name: 'Referer', value: 'https://original.example' },
- ],
- proxy: 'http://plugin-proxy:8888',
- createdBy: 'user' as const,
- requestedAt: 0,
- },
- contributors: {
- headers: ['plugin-rewriter'],
- proxy: 'plugin-rewriter',
- uris: 'plugin-rewriter',
- },
- staged,
- }),
- runBeforeFinalize: vi.fn(),
- runParallel: vi.fn(),
- } as unknown as Deps['orchestrator']
- const auditLog = {
- log: vi.fn(async () => {}),
- } as unknown as Deps['auditLog']
- const deps = makeDeps()
- const fullDeps = { ...deps, orchestrator, auditLog }
-
- await handleCreateTask(
- {
- type: 'http',
- uris: ['https://original.example/file.zip'],
- saveDir: '/dl',
- filename: 'file.zip',
- headers: [],
- },
- fullDeps
- )
-
- expect(deps.addUri).toHaveBeenCalledOnce()
- const [uris, options] = deps.addUri.mock.calls[0] as [
- string[],
- Record<string, unknown>,
- ]
- // Rewritten URI from plugin
- expect(uris).toEqual(['https://cdn.example/file-rewritten.zip'])
- // Headers from plugin chain (serialized to "Name: value")
- expect(options.header).toEqual([
- 'X-Token: secret',
- 'Referer: https://original.example',
- ])
- // Proxy from plugin chain
- expect(options['all-proxy']).toBe('http://plugin-proxy:8888')
- // Path overrides still applied by createTaskHandler
- expect(options.dir).toBe('/dl')
- expect(options.out).toBe('file.zip.motrix')
- })
-
- // (d) BT .torrent with selectedFiles (0-based → 1-based) + private torrent
- it('BT private torrent: select-file is 1-based, bt-tracker="", dir=diskPath, no out', async () => {
- const torrentBytes = makePrivateTorrentFixture()
- const deps = makeDeps()
- await handleCreateTask(
- {
- type: 'bt',
- payload: {
- kind: 'torrent-base64',
- base64: Buffer.from(torrentBytes).toString('base64'),
- },
- saveDir: '/dl',
- displayName: 'private-torrent',
- selectedFiles: [0, 2], // 0-based → aria2 expects '1,3'
- },
- deps
- )
- expect(deps.addTorrent).toHaveBeenCalledOnce()
- const [base64, extraUris, options] = deps.addTorrent.mock.calls[0] as [
- string,
- string[],
- Record<string, unknown>,
- ]
- // Positional arg 0: the base64 payload (same as request)
- expect(base64).toBe(Buffer.from(torrentBytes).toString('base64'))
- // Positional arg 1: extra uris — always empty for .torrent
- expect(extraUris).toEqual([])
- // LANDMINE: selectedFiles are 0-based in request, 1-based in aria2 wire format
- expect(options['select-file']).toBe('1,3')
- // Private torrent: bt-tracker forced to empty string
- expect(options['bt-tracker']).toBe('')
- // Valid torrent metadata uses a short, task-stable staging workspace.
- expect(options.dir).toMatch(/^\/dl\/\.motrix\/[a-f0-9]{20}$/)
- expect(options['index-out']).toEqual(['1=p'])
- // No `out` for BT tasks
- expect(options.out).toBeUndefined()
- })
-
- // (e) Magnet: dispatched via addUri with the magnet URI as-is
- it('magnet: dispatched via addUri, dir=diskPath, no out, no bt-tracker override', async () => {
- const deps = makeDeps()
- await handleCreateTask(
- {
- type: 'bt',
- payload: {
- kind: 'magnet',
- uri: 'magnet:?xt=urn:btih:aabbccddeeff00112233445566778899aabbccdd&dn=TestFile',
- },
- saveDir: '/dl',
- selectedFiles: [],
- displayName: 'TestFile',
- },
- deps
- )
- expect(deps.addUri).toHaveBeenCalledOnce()
- expect(deps.addTorrent).not.toHaveBeenCalled()
- const [uris, options] = deps.addUri.mock.calls[0] as [
- string[],
- Record<string, unknown>,
- ]
- // URI is the raw magnet string
- expect(uris).toEqual([
- 'magnet:?xt=urn:btih:aabbccddeeff00112233445566778899aabbccdd&dn=TestFile',
- ])
- // dir = diskPath for magnet (BT-like)
- expect(options.dir).toBe('/dl/TestFile.motrix')
- // No `out` for magnet tasks
- expect(options.out).toBeUndefined()
- // No bt-tracker override for magnet (only applied when isPrivateFromTorrent)
- expect(options['bt-tracker']).toBeUndefined()
- // No select-file for magnet (selectedFiles is empty)
- expect(options['select-file']).toBeUndefined()
- })
-
- // (f) Magnet WITH selectedFiles: pins the 1-based select-file wire that the
- // pre-refactor `addUri` path produced but no test previously asserted.
- it('magnet with selectedFiles: 1-based select-file via createDownload, dir=diskPath', async () => {
- const deps = makeDeps({ addUriGid: 'gid-m' })
- await handleCreateTask(
- {
- type: 'bt',
- payload: { kind: 'magnet', uri: 'magnet:?xt=urn:btih:x&dn=Mag' },
- selectedFiles: [0, 2],
- saveDir: '/d',
- displayName: 'Mag',
- },
- deps
- )
- const [uris, options] = deps.addUri.mock.calls[0] as [
- string[],
- Record<string, unknown>,
- ]
- expect(uris).toEqual(['magnet:?xt=urn:btih:x&dn=Mag'])
- // 0-based [0,2] → 1-based wire
- expect(options['select-file']).toBe('1,3')
- // diskPath
- expect(options.dir).toBe('/d/Mag.motrix')
- expect(options.out).toBeUndefined()
- })
-})
-
describe('handleCreateTask mux pre-resolve seam', () => {
it('routes http to dispatchMux (not engine) when resolveToMux returns a mux pair', async () => {
const muxPair = {
diff --git a/src/renderer/components/task/task-status-badge.test.tsx b/src/renderer/components/task/task-status-badge.test.tsx
index a6e72e66..0ec24792 100644
--- a/src/renderer/components/task/task-status-badge.test.tsx
+++ b/src/renderer/components/task/task-status-badge.test.tsx
@@ -21,37 +21,8 @@ describe('TaskStatusBadge', () => {
expect(icon).toHaveClass('animate-spin')
})
- it('uses destructive styling for the Error status', () => {
- const { container } = render(<TaskStatusBadge status={TaskStatus.Error} />)
- const badge = container.querySelector('[data-slot="task-status-badge"]')
- expect(badge).not.toBeNull()
- expect(badge).toHaveClass('bg-destructive')
- })
-
it('labels non-finalizing statuses with the lowercased enum value', () => {
render(<TaskStatusBadge status={TaskStatus.Downloading} />)
expect(screen.getByText('downloading')).toBeInTheDocument()
})
-
- it('does not spin the icon for non-loading statuses', () => {
- render(<TaskStatusBadge status={TaskStatus.Paused} />)
- const icon = screen.getByTestId('task-status-badge-icon')
- expect(icon).not.toHaveClass('animate-spin')
- })
-
- it('applies a caller-supplied className', () => {
- const { container } = render(
- <TaskStatusBadge status={TaskStatus.Queued} className="custom-xyz" />
- )
- const badge = container.querySelector('[data-slot="task-status-badge"]')
- expect(badge).toHaveClass('custom-xyz')
- })
-
- it('exposes the status via a data attribute for callsite styling', () => {
- const { container } = render(
- <TaskStatusBadge status={TaskStatus.Seeding} />
- )
- const badge = container.querySelector('[data-slot="task-status-badge"]')
- expect(badge).toHaveAttribute('data-status', TaskStatus.Seeding)
- })
})
diff --git a/src/renderer/routes/dashboard/components/dashboard-grid.test.tsx b/src/renderer/routes/dashboard/components/dashboard-grid.test.tsx
index ce5bf542..6e494a0f 100644
--- a/src/renderer/routes/dashboard/components/dashboard-grid.test.tsx
+++ b/src/renderer/routes/dashboard/components/dashboard-grid.test.tsx
@@ -1,6 +1,5 @@
import '@testing-library/jest-dom/vitest'
import '@renderer/lib/i18n'
-import { SidebarProvider } from '@renderer/components/ui/sidebar'
import { DEFAULT_DASHBOARD_LAYOUT } from '@shared/schemas/dashboard-layout'
import type {
DashboardLayoutSettings,
@@ -177,36 +176,6 @@ const COMPACT_PRESET_TILES: DashboardTileLayout[] = [
{ id: 'activity', enabled: false, x: 0, y: 0, w: 1, h: 1 },
]
-function renderCollapsedGrid() {
- const store = new Map<string, string>()
- vi.stubGlobal('localStorage', {
- getItem: (k: string) => store.get(k) ?? null,
- setItem: (k: string, v: string) => {
- store.set(k, v)
- },
- removeItem: (k: string) => {
- store.delete(k)
- },
- clear: () => store.clear(),
- })
- vi.stubGlobal(
- 'matchMedia',
- vi.fn().mockReturnValue({
- matches: false,
- addEventListener: vi.fn(),
- removeEventListener: vi.fn(),
- })
- )
- render(
- <SidebarProvider defaultOpen={false}>
- <DashboardGrid
- layout={DEFAULT_DASHBOARD_LAYOUT}
- renderTile={renderTile}
- />
- </SidebarProvider>
- )
-}
-
describe('DashboardGrid', () => {
afterEach(() => {
document.body.classList.remove('is-dashboard-dragging')
@@ -463,44 +432,6 @@ describe('DashboardGrid', () => {
])
})
- it('renders icon-only 28px actions on the collapsed header centerline', () => {
- renderCollapsedGrid()
-
- const configure = screen.getByRole('button', { name: /Configure|配置/i })
- expect(configure).toHaveClass(
- 'size-7',
- 'p-0',
- 'hover:bg-transparent',
- 'dark:hover:bg-transparent',
- 'panel-action-align-visual-end'
- )
- expect(configure.querySelector('svg')).toHaveClass('size-4')
- expect(configure).not.toHaveClass('[&>svg]:translate-y-0.5')
- expect(configure).not.toHaveTextContent(/Configure|配置/i)
-
- fireEvent.click(configure)
-
- const cancel = screen.getByRole('button', { name: /Cancel|取消/i })
- expect(cancel).toHaveClass('size-7', 'p-0', '[&>svg]:size-4')
- expect(cancel).not.toHaveTextContent(/Cancel|取消/i)
- })
-
- it('uses a 28px configure action in the expanded panel header', () => {
- renderDefaultGrid()
-
- const configure = screen.getByRole('button', { name: /Configure|配置/i })
- expect(configure).toHaveClass(
- 'size-7',
- 'items-center',
- 'justify-center',
- 'panel-action-align-visual-end',
- 'hover:bg-transparent',
- 'dark:hover:bg-transparent'
- )
- expect(configure.querySelector('svg')).toHaveClass('size-4')
- expect(configure).not.toHaveClass('size-8')
- })
-
it('shows all presets only while configuring and labels exact or custom drafts', async () => {
renderDefaultGrid()
diff --git a/src/renderer/routes/dashboard/components/dashboard-tile-frame.test.tsx b/src/renderer/routes/dashboard/components/dashboard-tile-frame.test.tsx
index 80bb6956..4f53132e 100644
--- a/src/renderer/routes/dashboard/components/dashboard-tile-frame.test.tsx
+++ b/src/renderer/routes/dashboard/components/dashboard-tile-frame.test.tsx
@@ -104,10 +104,9 @@ describe('DashboardTileFrame', () => {
const body = container.querySelector('[data-dashboard-tile-body]')
expect(body).toHaveAttribute('inert')
- expect(body).toHaveClass('[&>*]:pointer-events-none', '[&>*]:select-none')
})
- it('shows a bottom-right resize handle in editing mode', () => {
+ it('dispatches resize-handle pointer input in editing mode', () => {
const onResizeHandlePointerDown = vi.fn()
renderFrame({
@@ -118,13 +117,6 @@ describe('DashboardTileFrame', () => {
const handle = screen.getByRole('button', { name: 'Resize tile' })
fireEvent.pointerDown(handle)
- expect(handle).toHaveClass(
- 'absolute',
- 'right-0',
- 'bottom-0',
- 'size-5',
- 'cursor-nwse-resize'
- )
expect(onResizeHandlePointerDown).toHaveBeenCalledWith(
'engine',
expect.any(Object)
diff --git a/src/renderer/routes/dashboard/components/tile-segmented-control.test.tsx b/src/renderer/routes/dashboard/components/tile-segmented-control.test.tsx
index c02306e4..91f245cb 100644
--- a/src/renderer/routes/dashboard/components/tile-segmented-control.test.tsx
+++ b/src/renderer/routes/dashboard/components/tile-segmented-control.test.tsx
@@ -47,64 +47,6 @@ function ControlledSegmentedControl({
}
describe('TileSegmentedControl', () => {
- it('preserves the Transfer geometry and selected treatment', () => {
- render(
- <TileSegmentedControl
- ariaLabel="Task view"
- value="active"
- options={OPTIONS}
- onValueChange={vi.fn()}
- />
- )
-
- const group = screen.getByRole('radiogroup', { name: 'Task view' })
- const active = screen.getByRole('radio', { name: 'Active' })
- const failed = screen.getByRole('radio', { name: 'Failed' })
-
- expect(group).toHaveClass(
- 'rounded-md',
- 'bg-muted/70',
- 'p-0.5',
- '[&>*]:focus-visible:relative',
- '[&>*]:focus-visible:z-10'
- )
- expect(active).toHaveClass(
- 'h-5',
- 'rounded-md!',
- 'border-0',
- 'px-2',
- 'text-[10px]',
- 'font-medium',
- 'bg-background',
- 'text-foreground',
- 'shadow-xs',
- 'hover:bg-background',
- 'dark:hover:bg-background'
- )
- expect(failed).toHaveClass('shadow-none')
- expect(failed).not.toHaveClass('shadow-xs')
- })
-
- it('keeps a 20px visual option with a 24px vertical hit target', () => {
- render(
- <TileSegmentedControl
- ariaLabel="Task view"
- value="active"
- options={OPTIONS}
- onValueChange={vi.fn()}
- />
- )
-
- expect(screen.getByRole('radio', { name: 'Active' })).toHaveClass(
- 'relative',
- 'h-5',
- 'after:absolute',
- 'after:inset-x-0',
- 'after:-inset-y-0.5',
- "after:content-['']"
- )
- })
-
it('exposes radio semantics, one tab stop, and the forwarded root ref', () => {
const ref = createRef<HTMLDivElement>()
render(
@@ -291,19 +233,4 @@ describe('TileSegmentedControl', () => {
fireEvent.keyDown(radios[0] as HTMLElement, { key: 'ArrowRight' })
expect(onValueChange).not.toHaveBeenCalled()
})
-
- it('removes transitions for reduced-motion users', () => {
- render(
- <TileSegmentedControl
- ariaLabel="Task view"
- value="active"
- options={OPTIONS}
- onValueChange={vi.fn()}
- />
- )
-
- for (const radio of screen.getAllByRole('radio')) {
- expect(radio).toHaveClass('motion-reduce:transition-none')
- }
- })
})
diff --git a/src/renderer/routes/dashboard/dashboard-page.test.tsx b/src/renderer/routes/dashboard/dashboard-page.test.tsx
index 96af3ab0..1259d409 100644
--- a/src/renderer/routes/dashboard/dashboard-page.test.tsx
+++ b/src/renderer/routes/dashboard/dashboard-page.test.tsx
@@ -215,21 +215,6 @@ describe('DashboardPage', () => {
expect(grid?.className).toContain('@[560px]:grid-cols-4')
})
- it('uses the calibrated desktop tile canvas horizontal spacing', async () => {
- await act(async () => {
- render(<DashboardPage />)
- })
-
- const grid = screen.getByTestId('dashboard-grid')
- const content = grid.parentElement?.parentElement?.parentElement
-
- // At a 914px-wide window with the expanded 200px sidebar and 8px inset,
- // 10px left plus 8px right padding leave a 688px canvas. The inset and
- // right padding together preserve the intended 16px right-side margin.
- expect(content).toHaveClass('pl-2.5', 'pr-2', 'pt-4', 'pb-10')
- expect(grid).toHaveClass('@[560px]:pt-0')
- })
-
it('renders configure controls in the panel header actions', async () => {
let container: HTMLElement | undefined
await act(async () => {
diff --git a/src/renderer/routes/dashboard/tiles/active-tile.test.tsx b/src/renderer/routes/dashboard/tiles/active-tile.test.tsx
index 16abb419..214ecfb8 100644
--- a/src/renderer/routes/dashboard/tiles/active-tile.test.tsx
+++ b/src/renderer/routes/dashboard/tiles/active-tile.test.tsx
@@ -72,23 +72,4 @@ describe('ActiveTile', () => {
'justify-between'
)
})
-
- it.each([
- ['compact', compactViewport],
- ['summary', summaryViewport],
- ['detailed', detailedViewport],
- ['focus', focusViewport],
- ])('keeps the primary KPI line box tight in %s', (_label, viewport) => {
- const { container } = render(
- <ActiveTile activeCount={4} viewport={viewport} />
- )
-
- expect(container.querySelector('[data-slot="kpi-number"]')).toHaveClass(
- 'leading-none'
- )
- expect(container.querySelector('[data-slot="tile-title"]')).toHaveClass(
- 'h-8',
- 'text-[32px]'
- )
- })
})
diff --git a/src/renderer/routes/dashboard/tiles/speed-tile.test.tsx b/src/renderer/routes/dashboard/tiles/speed-tile.test.tsx
index f567b344..59be731c 100644
--- a/src/renderer/routes/dashboard/tiles/speed-tile.test.tsx
+++ b/src/renderer/routes/dashboard/tiles/speed-tile.test.tsx
@@ -42,12 +42,6 @@ const FOCUS = {
contentLevel: 'focus',
} satisfies DashboardTileViewport
-const FULL_WIDTH_FOCUS = {
- span: { w: 4, h: 1 },
- orientation: 'wide',
- contentLevel: 'focus',
-} satisfies DashboardTileViewport
-
describe('SpeedTile', () => {
it('renders the UPLOAD label and current up speed', () => {
render(<SpeedTile kind="up" history={points} viewport={SUMMARY} />)
@@ -121,25 +115,4 @@ describe('SpeedTile', () => {
expect(screen.getAllByText(/0\s*B\/s/).length).toBeGreaterThanOrEqual(1)
expect(screen.queryByText('1 B/s')).not.toBeInTheDocument()
})
-
- it.each([
- ['compact', COMPACT],
- ['summary', SUMMARY],
- ['wide detailed', WIDE_DETAILED],
- ['full-width focus', FULL_WIDTH_FOCUS],
- ['square detailed', SQUARE_DETAILED],
- ['large focus', FOCUS],
- ])('keeps the primary KPI line box tight in %s', (_label, viewport) => {
- const { container } = render(
- <SpeedTile kind="up" history={points} viewport={viewport} />
- )
-
- expect(container.querySelector('[data-slot="kpi-number"]')).toHaveClass(
- 'leading-none'
- )
- expect(container.querySelector('[data-slot="tile-title"]')).toHaveClass(
- 'h-8',
- 'text-[32px]'
- )
- })
})
diff --git a/src/renderer/routes/dashboard/tiles/tasks-tile.test.tsx b/src/renderer/routes/dashboard/tiles/tasks-tile.test.tsx
index 444e3297..4d26d87e 100644
--- a/src/renderer/routes/dashboard/tiles/tasks-tile.test.tsx
+++ b/src/renderer/routes/dashboard/tiles/tasks-tile.test.tsx
@@ -210,18 +210,11 @@ describe('TasksTile', () => {
vi.useRealTimers()
})
- it('puts a shared three-option radio control in the tile header', () => {
+ it('exposes a three-option radio control with Active selected', () => {
renderTile()
const group = screen.getByRole('radiogroup', { name: 'Task view' })
- expect(group).toHaveClass('rounded-md', 'bg-muted/70', 'p-0.5')
expect(within(group).getAllByRole('radio')).toHaveLength(3)
- expect(within(group).getByRole('radio', { name: 'Active' })).toHaveClass(
- 'h-5',
- 'px-2',
- 'text-[10px]',
- 'rounded-md!'
- )
expect(
within(group).getByRole('radio', { name: 'Active' })
).toHaveAttribute('aria-checked', 'true')
@@ -263,46 +256,6 @@ describe('TasksTile', () => {
expect(progress).toHaveClass('left-[26px]', 'right-1', 'w-auto')
})
- it.each([
- ['2x1', 'h-6', null, null],
- ['2x2', 'h-10', 'py-1', 'pt-2'],
- ['2x3', 'h-10', 'py-1', 'pt-2'],
- ['3x2', 'h-8', 'py-0.5', 'pt-2'],
- ['3x3', 'h-9', 'py-0.5', 'pt-2'],
- ['4x2', 'h-8', 'py-0.5', 'pt-1'],
- ] as const)(
- 'uses deliberate row spacing for %s without changing its capacity',
- (viewportKey, heightClass, verticalPaddingClass, topPaddingClass) => {
- setSource([task('spacing')])
- const { container } = renderTile({
- viewport: VIEWPORTS[viewportKey],
- })
-
- const list = screen.getByTestId('tasks-list')
- const row = screen.getByTestId('tasks-row')
- const rowSlot = row.closest('li')
- const visualContent = row.parentElement?.querySelector('[aria-hidden]')
- const body = container.querySelector('[data-slot="card-content"]')
-
- expect(rowSlot).toHaveClass('px-1', heightClass)
- expect(visualContent).toHaveClass('px-1')
-
- if (verticalPaddingClass === null) {
- expect(body).not.toHaveClass('pt-1', 'pt-2')
- expect(list).not.toHaveClass('gap-1')
- expect(visualContent).toHaveClass('gap-2')
- } else {
- expect(body).toHaveClass(topPaddingClass)
- expect(list).toHaveClass('gap-1')
- expect(visualContent).toHaveClass(
- 'grid-cols-[14px_minmax(0,1fr)_auto]',
- 'gap-x-2',
- verticalPaddingClass
- )
- }
- }
- )
-
it('keeps ordering stable when only speed and progress change', () => {
const first = [
task('older', TaskStatus.Downloading, {
@@ -358,15 +311,6 @@ describe('TasksTile', () => {
expect(screen.getByTestId('tasks-more')).toHaveTextContent(
`${10 - (limit - 1)} more`
)
- expect(screen.getByTestId('tasks-more').closest('li')).toHaveClass('px-1')
- expect(screen.getByTestId('tasks-more')).toHaveClass(
- 'pr-1',
- viewportKey === '2x1' ? 'pl-1' : 'pl-[26px]'
- )
- expect(screen.getByTestId('tasks-list')).not.toHaveClass(
- 'overflow-auto',
- 'grid-cols-2'
- )
}
)
@@ -378,7 +322,6 @@ describe('TasksTile', () => {
expect(list.querySelector('svg')).toBeNull()
expect(list.querySelector('[aria-hidden]')).not.toHaveTextContent(/ETA/i)
expect(screen.queryByRole('progressbar')).toBeNull()
- expect(screen.getByTestId('tasks-row').closest('li')).toHaveClass('h-6')
})
it('separates Failed and Recent without meaningless progress', async () => {
diff --git a/src/renderer/routes/dashboard/tiles/transfer-tile.test.tsx b/src/renderer/routes/dashboard/tiles/transfer-tile.test.tsx
index 82510912..5193d072 100644
--- a/src/renderer/routes/dashboard/tiles/transfer-tile.test.tsx
+++ b/src/renderer/routes/dashboard/tiles/transfer-tile.test.tsx
@@ -146,45 +146,26 @@ describe('TransferTile', () => {
expect(screen.getByTestId('transfer-total')).toHaveTextContent('3.0 GB')
})
- it.each([
- { label: '2x1', span: { w: 2 as const, h: 1 as const } },
- { label: '2x2', span: { w: 2 as const, h: 2 as const } },
- { label: '4x1', span: { w: 4 as const, h: 1 as const } },
- ])('preserves the original endpoint chart at $label', ({ span }) => {
- renderTile({ span })
+ it('renders ordered transfer endpoints with proportional segments', () => {
+ renderTile()
- const chart = screen.getByTestId('transfer-chart')
- const directions = screen.getByTestId('transfer-directions')
const labels = screen.getByTestId('transfer-direction-labels')
const values = screen.getByTestId('transfer-direction-values')
const bar = screen.getByTestId('transfer-proportion-bar')
const upload = screen.getByTestId('transfer-upload-segment')
const download = screen.getByTestId('transfer-download-segment')
- expect(chart).toHaveClass('mt-auto')
- expect(directions).toHaveClass('text-muted-foreground')
- expect(labels).toHaveClass(
- 'flex',
- 'justify-between',
- 'text-[11px]',
- 'leading-none'
- )
expect(labels).toHaveTextContent(/Up.*Down/)
- expect(values).toHaveClass('flex', 'justify-between')
expect(labels.compareDocumentPosition(values)).toBe(
Node.DOCUMENT_POSITION_FOLLOWING
)
expect(values.compareDocumentPosition(bar)).toBe(
Node.DOCUMENT_POSITION_FOLLOWING
)
- expect(bar).toHaveClass('h-6', 'w-full', 'gap-1')
- expect(bar).not.toHaveClass('rounded-full', 'bg-muted')
expect(bar).toHaveAttribute('aria-hidden')
expect(upload.compareDocumentPosition(download)).toBe(
Node.DOCUMENT_POSITION_FOLLOWING
)
- expect(upload).toHaveClass('h-full', 'rounded-sm')
- expect(download).toHaveClass('h-full', 'rounded-sm')
expect(upload).toHaveStyle({ width: '23.12%' })
expect(download).toHaveStyle({ width: '76.88%' })
})
@@ -244,22 +225,6 @@ describe('TransferTile', () => {
expect(content.className).not.toContain('focusHorizontal')
})
- it.each([
- { label: '1x1', span: { w: 1 as const, h: 1 as const } },
- { label: '2x1', span: { w: 2 as const, h: 1 as const } },
- { label: '1x2', span: { w: 1 as const, h: 2 as const } },
- { label: '2x2', span: { w: 2 as const, h: 2 as const } },
- { label: '4x1', span: { w: 4 as const, h: 1 as const } },
- ])('keeps the primary KPI line box tight at $label', ({ span }) => {
- renderTile({ span })
-
- expect(screen.getByTestId('transfer-total').firstElementChild).toHaveClass(
- 'h-8',
- 'text-[32px]',
- 'leading-none'
- )
- })
-
it('keeps scope switching, stacked directions, and coverage in 1x2', async () => {
const user = userEvent.setup({ pointerEventsCheck: 0 })
const partialSnapshot: TransferStatsSnapshot = {
@@ -369,20 +334,6 @@ describe('TransferTile', () => {
expect(screen.queryByText(/Since 2:00 PM/i)).toBeNull()
})
- it('keeps the range skeleton before the KPI skeleton in loading 1x2', () => {
- const { container } = renderTile({
- span: { w: 1, h: 2 },
- state: { status: 'loading', retry: vi.fn() },
- })
-
- const tile = container.querySelector('.dashboard-tile')
- const skeletons = container.querySelectorAll('[data-slot="skeleton"]')
-
- expect(tile).toHaveClass('gap-0')
- expect(skeletons[0]).toHaveClass('h-6', 'w-full')
- expect(skeletons[1]).toHaveClass('h-8', 'w-24')
- })
-
it('never presents loading or unavailable data as zero and retries', async () => {
const user = userEvent.setup()
const retry = vi.fn()
diff --git a/src/renderer/routes/downloads/downloads-page.test.tsx b/src/renderer/routes/downloads/downloads-page.test.tsx
index 609de5a4..c2642143 100644
--- a/src/renderer/routes/downloads/downloads-page.test.tsx
+++ b/src/renderer/routes/downloads/downloads-page.test.tsx
@@ -168,22 +168,14 @@ beforeEach(() => {
})
describe('DownloadsPage', () => {
- it('renders the status title heading and collapsed search trigger', () => {
+ it('renders the status title heading and search trigger', () => {
renderAt('/downloads/all')
expect(
screen.getByRole('heading', { name: /downloads/i })
).toBeInTheDocument()
- const search = screen.getByRole('button', { name: /search downloads/i })
- expect(search).toHaveClass(
- 'size-7',
- 'items-center',
- 'justify-center',
- 'hover:bg-transparent',
- 'dark:hover:bg-transparent',
- 'panel-action-align-visual-end'
- )
- expect(search.querySelector('svg')).toHaveClass('size-4')
- expect(search).not.toHaveClass('size-8')
+ expect(
+ screen.getByRole('button', { name: /search downloads/i })
+ ).toBeInTheDocument()
})
it.each([
diff --git a/src/renderer/routes/downloads/inspector/current-summary-card.test.tsx b/src/renderer/routes/downloads/inspector/current-summary-card.test.tsx
index 3d019529..94014db6 100644
--- a/src/renderer/routes/downloads/inspector/current-summary-card.test.tsx
+++ b/src/renderer/routes/downloads/inspector/current-summary-card.test.tsx
@@ -33,29 +33,4 @@ describe('CurrentSummaryCard', () => {
expect(screen.queryByText(/Progress/i)).toBeNull()
expect(screen.queryByText(/ETA/i)).toBeNull()
})
-
- it('keeps both live speeds complete in the narrow two-column card', () => {
- render(
- <CurrentSummaryCard
- task={makeDownloadTask({
- downloadSpeed: 384 * 1_024,
- uploadSpeed: 72 * 1_024,
- })}
- lifetime={null}
- />
- )
-
- const download = screen.getByText('384 KB/s')
- const upload = screen.getByText('72.0 KB/s')
- expect(download).toHaveClass('whitespace-nowrap', 'text-base')
- expect(upload).toHaveClass('whitespace-nowrap')
- expect(download).not.toHaveClass('truncate')
- expect(upload).not.toHaveClass('truncate')
- const summary = screen.getByTestId('task-inspector-activity-summary-card')
- expect(summary).toHaveClass('@container/summary', 'border-y', 'py-3')
- expect(summary).not.toHaveClass('rounded-md', 'border')
- expect(
- screen.getByTestId('task-inspector-activity-summary-secondary')
- ).toHaveClass('divide-x')
- })
})
diff --git a/src/renderer/routes/downloads/status-pill.test.tsx b/src/renderer/routes/downloads/status-pill.test.tsx
index f4d72714..d914004d 100644
--- a/src/renderer/routes/downloads/status-pill.test.tsx
+++ b/src/renderer/routes/downloads/status-pill.test.tsx
@@ -16,14 +16,4 @@ describe('StatusPill', () => {
expect(screen.getByText('Fetching')).toBeInTheDocument()
expect(screen.queryByText('Fetching metadata')).not.toBeInTheDocument()
})
-
- it('applies tone classes from task-status-ui', () => {
- const { container } = render(<StatusPill status={TaskStatus.Error} />)
- expect(container.firstChild).toHaveClass('bg-red-100')
- })
-
- it('does not shrink when adjacent inspector metadata is long', () => {
- render(<StatusPill status={TaskStatus.Downloading} />)
- expect(screen.getByTestId('task-status-pill')).toHaveClass('shrink-0')
- })
})
diff --git a/src/renderer/routes/notifications/notifications-page.test.tsx b/src/renderer/routes/notifications/notifications-page.test.tsx
index 7090abc5..8cd5f7cf 100644
--- a/src/renderer/routes/notifications/notifications-page.test.tsx
+++ b/src/renderer/routes/notifications/notifications-page.test.tsx
@@ -87,43 +87,6 @@ describe('<NotificationsPage>', () => {
expect(screen.queryByRole('list')).not.toBeInTheDocument()
})
- it('renders a severity icon per row', async () => {
- mockList([
- notification({ id: 'e1', severity: 'error' }),
- notification({
- id: 'w1',
- severity: 'warning',
- titleKey: 'notification.engineFailure.title',
- titleParams: null,
- taskId: null,
- }),
- notification({
- id: 'i1',
- severity: 'info',
- titleKey: 'notification.taskComplete.title',
- titleParams: { name: 'x' },
- }),
- ])
- const { container } = renderPage()
- await screen.findByText('file.zip failed')
- expect(container.querySelector('svg.text-destructive')).not.toBeNull()
- expect(container.querySelector('svg.text-amber-500')).not.toBeNull()
- expect(container.querySelector('svg.text-sky-500')).not.toBeNull()
- })
-
- it('falls back to the info icon and does not crash when severity is out of the known set (tampered db)', async () => {
- mockList([
- notification({
- // Simulates a tampered/legacy row the unchecked store cast lets
- // through — the type system alone would never produce this value.
- severity: 'bogus-severity' as AppNotification['severity'],
- }),
- ])
- const { container } = renderPage()
- await screen.findByText('file.zip failed')
- expect(container.querySelector('svg.text-sky-500')).not.toBeNull()
- })
-
it('renders the raw key and warns when titleKey is unknown to the catalog', async () => {
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
mockList([
diff --git a/src/renderer/routes/plugins/components/plugin-audience-badge.test.tsx b/src/renderer/routes/plugins/components/plugin-audience-badge.test.tsx
index e3888d15..b556ab55 100644
--- a/src/renderer/routes/plugins/components/plugin-audience-badge.test.tsx
+++ b/src/renderer/routes/plugins/components/plugin-audience-badge.test.tsx
@@ -9,14 +9,4 @@ describe('PluginAudienceBadge', () => {
render(<PluginAudienceBadge tone="safe" />)
expect(screen.getByText('Looks safe')).toBeInTheDocument()
})
-
- it('applies the amber palette for review tone', () => {
- const { container } = render(<PluginAudienceBadge tone="review" />)
- expect(container.firstChild).toHaveClass('bg-amber-100', 'text-amber-700')
- })
-
- it('applies the slate palette for off tone', () => {
- const { container } = render(<PluginAudienceBadge tone="off" />)
- expect(container.firstChild).toHaveClass('bg-slate-100', 'text-slate-600')
- })
})
diff --git a/src/renderer/routes/settings/cards/about-dialog.test.tsx b/src/renderer/routes/settings/cards/about-dialog.test.tsx
index f67556ce..98135a7c 100644
--- a/src/renderer/routes/settings/cards/about-dialog.test.tsx
+++ b/src/renderer/routes/settings/cards/about-dialog.test.tsx
@@ -417,17 +417,6 @@ describe('<AboutDialog>', () => {
)
})
- it('does not scale About actions while they are pressed', () => {
- renderDialog()
-
- for (const button of screen.getAllByRole('button')) {
- expect(button.className).not.toContain('active:scale')
- }
- for (const link of screen.getAllByRole('link')) {
- expect(link.className).not.toContain('active:scale')
- }
- })
-
it('keeps release notes out of the compact dialog', () => {
renderDialog()