Skip to content

A full-featured download manager.

ci: prune low-value tests and run suites once

Dr_rOoted34c0e61fdb
diff --git a/.claude/rules/commit-and-quality.md b/.claude/rules/commit-and-quality.md
index 2e869fc9..d0fd2631 100644
--- a/.claude/rules/commit-and-quality.md
+++ b/.claude/rules/commit-and-quality.md
@@ -51,3 +51,14 @@ Run every check that matches the change:
Use `pnpm exec biome check --write .` only for reviewed, auto-fixable
issues; re-run the required gate afterward.
+
+## Test Value
+
+- Prefer observable behavior, failure recovery, data integrity, permissions,
+ and compatibility boundaries over assertions that copy implementation text.
+- Do not add tests just to repeat constants, documentation wording, CSS utility
+ lists, or static presentation tables. Exercise the behavior consuming them.
+- Keep static checks when they protect a boundary that cannot be safely
+ exercised in tests, such as release credentials and publication gates.
+- CI should run each test once per relevant execution environment. Do not add
+ focused test lists before the full suite when both execute the same cases.
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index cc18a307..0ee24354 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -56,111 +56,12 @@ jobs:
- name: i18n catalog and translation contract
run: pnpm run check:i18n
- - name: Desktop graphics recovery contracts
- run: >-
- pnpm exec vitest run
- src/main/platform/graphics-recovery.test.ts
- src/main/platform/graphics-recovery-runtime.test.ts
- src/renderer/hooks/use-graphics-recovery-toast.test.tsx
- src/renderer/routes/settings/cards/appearance-dialog.test.tsx
- src/core/settings/settings-manager.test.ts
- src/shared/schemas/app-settings.test.ts
- src/renderer/lib/settings-save.test.tsx
-
- - name: Locale runtime contracts
- run: >-
- pnpm exec vitest run
- src/shared/constants/locales.test.ts
- src/shared/i18n-resources.test.ts
- src/shared/i18n-resource-loading.test.ts
- src/shared/schemas/locale.test.ts
- src/shared/protocol/forwardable-events.test.ts
- src/core/i18n/locale-coordinator.test.ts
- src/core/settings/settings-manager.test.ts
- src/core/plugin/plugin-registry.test.ts
- src/core/plugin/capabilities/i18n.test.ts
- src/core/plugin/host/plugin-host.test.ts
- src/core/plugin/host/quick-js-worker.locale.test.ts
- src/main/ipc/events.test.ts
- src/main/ipc/disclaimer.test.ts
- src/main/ipc/queries.test.ts
- src/server/ipc/queries.test.ts
- src/shared/schemas/app-settings.test.ts
- src/main/plugin/capability-host.test.ts
- src/main/plugin/host-language.test.ts
- src/main/window/window-manager.test.ts
- src/server/plugin/capability-host.test.ts
- src/preload/preload.test.ts
- src/renderer/lib/bootstrap-locale.test.ts
- src/renderer/lib/i18n.test.ts
- src/renderer/components/ui/primitives-i18n.test.tsx
- src/renderer/components/language-sync.test.tsx
- src/renderer/components/locale-direction-provider.test.tsx
- src/renderer/components/onboarding/onboarding-language-select.test.tsx
- src/renderer/routes/plugins/hooks/use-plugin-detail.test.tsx
- src/renderer/routes/plugins/hooks/use-plugins.test.tsx
- src/renderer/routes/settings/cards/appearance-dialog.test.tsx
- tests/scripts/check-i18n.test.ts
-
- - name: Marketplace registry contracts
- run: >-
- pnpm exec vitest run
- src/shared/schemas/registry.test.ts
- src/core/plugin/registry/registry-client.test.ts
- src/renderer/routes/plugins/lib/registry-text.test.ts
- src/renderer/routes/plugins/plugins-page.test.tsx
- src/renderer/routes/plugins/components/registry-plugin-card.test.tsx
- src/renderer/routes/plugins/components/registry-detail-panel.test.tsx
- src/core/plugin/registry/registry-fetcher.test.ts
- src/core/plugin/registry/update-scan.test.ts
- src/core/plugin/install/e2e-install.test.ts
- src/core/plugin/install/registry-expectation.test.ts
- src/core/plugin/update/builtin-updater.test.ts
- src/core/plugin/update/signature.test.ts
-
- # The runtime test repeats the real loopback proxy probe under Electron's
- # embedded Node via ELECTRON_RUN_AS_NODE; keep the hydrated runtime above.
- - name: Undici proxy compatibility (Node + Electron)
- run: >-
- pnpm exec vitest run
- src/core/engine/aria2/aria2-adapter.test.ts
- src/core/engine/aria2/aria2-config-builder.test.ts
- src/core/engine/aria2/aria2-process-manager.test.ts
- src/core/engine/aria2/aria2-trust-store.test.ts
- src/core/engine/engine-supervisor.test.ts
- src/core/proxy/applied-download-proxy-policy.test.ts
- src/core/proxy/applier.test.ts
- src/core/proxy/aria2-proxy-routing.test.ts
- src/core/proxy/serializers.test.ts
- src/core/session/session-manager.test.ts
- src/core/task/actions/re-add-task.test.ts
- src/core/task/create-task-handler.test.ts
- src/core/task/direct-resource-validator.test.ts
- src/core/task/direct-resource-validator.proxy-contract.test.ts
- src/core/task/direct-resource-validator.proxy.test.ts
- src/core/tracker/tracker-prober.test.ts
- src/core/tracker/tracker-syncer.test.ts
- src/main/ipc/commands.test.ts
- src/server/ipc/commands.test.ts
- env:
- MOTRIX_REQUIRE_ELECTRON_PROXY_TEST: '1'
-
- - name: Undici response and dispatcher lifecycle
- run: >-
- pnpm exec vitest run
- src/core/geoip/geo-ip-downloader.test.ts
- src/core/media/manifest-fetcher.test.ts
- src/core/plugin/capabilities/http.proxy-lifecycle.test.ts
- src/core/plugin/install/github-fetcher.test.ts
- src/core/plugin/install/url-fetcher.test.ts
- src/core/plugin/registry/registry-client.test.ts
- src/server/plugin/install-service.test.ts
-
- name: Schema parity check
run: pnpm run check:schema-parity
- name: Third-party notice contract
- run: pnpm run check:third-party-notices
+ # The verifier tests run once in the full suite below.
+ run: node scripts/generate-third-party-notices.mjs --check
- name: File naming conventions
run: pnpm run check:file-names
@@ -168,99 +69,28 @@ jobs:
- name: Architecture and icon import boundaries
run: pnpm run check:boundaries
- # Fingerprint the resolved Biome first: lint verdicts have disagreed
- # between runs with identical inputs before, and the version line is
- # the fastest way to tell a toolchain drift from a real finding.
- name: Biome toolchain fingerprint
run: |
pnpm exec biome --version
pnpm ls @biomejs/biome
- # Single source of truth for lint scope: package.json's `lint` script
- # (`biome check .`), bounded by biome.json. Keep this in lockstep with
- # the local commit gate in .claude/rules/commit-and-quality.md.
- name: Lint
run: pnpm run lint
+ - name: Type-check (root)
+ run: pnpm exec tsc --noEmit
+
- name: Native host JavaScript tooling tests
run: >-
node --test
packages/native-host/build.test.mjs
packages/native-host/package-flatpak-companion.test.mjs
- - name: Release and packaging contracts
- run: >-
- pnpm exec vitest run
- src/main/bridge/native-messaging-installer.test.ts
- src/main/bridge/bootstrap-lifecycle.test.ts
- src/main/bridge/native-host-path.test.ts
- src/main/bridge/native-messaging-extensions.test.ts
- src/main/bridge/snap-environment.test.ts
- tests/scripts/assemble-release-artifacts.test.ts
- tests/scripts/app-deep-link-registration.test.ts
- tests/scripts/appimage-artifact.test.ts
- tests/scripts/before-pack-verify.test.ts
- tests/scripts/compose-server.test.ts
- tests/scripts/container-platform-metadata.test.ts
- tests/scripts/container-publication-state.test.ts
- tests/scripts/container-release-metadata.test.ts
- tests/scripts/docker-server-docs.test.ts
- tests/scripts/electron-package-contract.test.ts
- tests/scripts/flatpak-native-host.test.ts
- tests/scripts/finalize-appimage-artifact.test.ts
- tests/scripts/fetch-engine.test.ts
- tests/scripts/fetch-engine-path-parity.test.ts
- tests/scripts/native-binary-target.test.ts
- tests/scripts/obsidian-docs.test.ts
- tests/scripts/release-metadata.test.ts
- tests/scripts/release-signing-input.test.ts
- tests/scripts/release-version-contract.test.ts
- tests/scripts/snap-artifact.test.ts
- tests/scripts/snap-build-set-release.test.ts
- tests/scripts/snap-project.test.ts
- tests/scripts/snap-store-channel.test.ts
- tests/scripts/stage-electron-app.test.ts
- tests/scripts/audit-server-runtime.test.ts
- tests/scripts/production-build.test.ts
- tests/scripts/docker-server-runtime.test.ts
- tests/scripts/server-runtime-workflow.test.ts
- tests/scripts/smoke-server-package.test.ts
- tests/scripts/smoke-electron-cleanup.test.ts
- tests/scripts/stage-server-app.test.ts
- tests/scripts/verify-electron-package.test.ts
- tests/scripts/verify-appimage-artifact.test.ts
- tests/scripts/verify-pacman-artifact.test.ts
- tests/scripts/verify-container-publication.test.ts
- tests/scripts/verify-server-package.test.ts
- tests/scripts/verify-update-artifacts.test.ts
- tests/scripts/windows-artifact-names.test.ts
- tests/scripts/workflow-release-matrix.test.ts
- tests/scripts/workflow-flatpak-release.test.ts
- tests/scripts/workflow-snap.test.ts
-
- - name: Type-check (root)
- run: pnpm exec tsc --noEmit
-
- - name: Verified FFmpeg installation contracts
- run: >-
- pnpm exec vitest run
- src/core/ffmpeg/verified-install.test.ts
- src/core/plugin/capabilities/ffmpeg.test.ts
- src/main/plugin/ffmpeg-fetch-electron.test.ts
- src/main/plugin/ffmpeg-macos-trust.test.ts
- src/main/plugin/ffmpeg-probe-managed.test.ts
- src/main/plugin/ffmpeg-probe-electron.test.ts
- src/renderer/routes/settings/cards/integration/media-tools-section.test.tsx
-
- name: Tests (root)
- # Temporarily non-blocking. Known pre-existing failures (unrelated to
- # Plan G — all confirmed on main):
- # - src/renderer/layouts/app-layout.test.tsx (1)
- # - src/renderer/routes/dashboard/tiles/engine-tile.test.tsx (2)
- # - src/core/geoip/geo-ip-manager.test.ts (intermittent ENOTEMPTY)
- # Remove continue-on-error once each is resolved.
- continue-on-error: true
+ # Run each test once, including the embedded Electron Node proxy probe.
run: pnpm test
+ env:
+ MOTRIX_REQUIRE_ELECTRON_PROXY_TEST: '1'
server-runtime:
name: Server runtime / ${{ matrix.target }}
diff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.yml
index 51ef34b7..220e0879 100644
--- a/.github/workflows/flatpak.yml
+++ b/.github/workflows/flatpak.yml
@@ -217,7 +217,6 @@ jobs:
pnpm --config.verify-deps-before-run=false run check:flatpak
pnpm --config.verify-deps-before-run=false exec vitest run \
tests/scripts/flatpak-native-host.test.ts \
- tests/scripts/flatpak-packaging.test.ts \
tests/scripts/flatpak-project.test.ts \
tests/scripts/normalize-flatpak-cargo-sources.test.ts \
tests/scripts/normalize-flatpak-node-sources.test.ts \
diff --git a/docs/plugin-hook-runtime-plan.md b/docs/plugin-hook-runtime-plan.md
index 38e28692..9b0f39e1 100644
--- a/docs/plugin-hook-runtime-plan.md
+++ b/docs/plugin-hook-runtime-plan.md
@@ -238,8 +238,6 @@ Update/add:
- `src/core/plugin/host/orchestrator.e2e.test.ts`
- `src/core/task/create-task-handler.plugin-hook-e2e.test.ts`
- `src/core/plugin/host/e2e-hook-compatibility.test.ts`
-- `src/main/plugin/hook-runtime-assembly.test.ts`
-- `src/server/plugin/hook-runtime-assembly.test.ts`
- reusable local HTTP/TLS test server and fault adapters under existing test
helper conventions
diff --git a/docs/plugin-hook-runtime-plan.zh-CN.md b/docs/plugin-hook-runtime-plan.zh-CN.md
index 67a59a36..60365417 100644
--- a/docs/plugin-hook-runtime-plan.zh-CN.md
+++ b/docs/plugin-hook-runtime-plan.zh-CN.md
@@ -217,8 +217,6 @@ no-op。
- `src/core/plugin/host/orchestrator.e2e.test.ts`
- `src/core/task/create-task-handler.plugin-hook-e2e.test.ts`
- `src/core/plugin/host/e2e-hook-compatibility.test.ts`
-- `src/main/plugin/hook-runtime-assembly.test.ts`
-- `src/server/plugin/hook-runtime-assembly.test.ts`
- 按既有 test helper 约定添加本地 HTTP/TLS server 与 fault adapter
测试从 `scripts/builtins.lock.json` 读取精确 archive,并在安装前断言 size、
diff --git a/src/core/legacy-import/http-activation-service.test.ts b/src/core/legacy-import/http-activation-service.test.ts
index 1b9421f5..eb68dd2d 100644
--- a/src/core/legacy-import/http-activation-service.test.ts
+++ b/src/core/legacy-import/http-activation-service.test.ts
@@ -345,7 +345,7 @@ describe('durable HTTP legacy activation', () => {
).rejects.toThrow()
expect(f.adapter.importLegacyCheckpoint).not.toHaveBeenCalled()
expect(f.adapter.createDownload).not.toHaveBeenCalled()
- expect(await readFile(f.target)).toEqual(f.payload)
+ expect((await readFile(f.target)).equals(f.payload)).toBe(true)
})
it('rechecks the source after native creation before unpausing', async () => {
@@ -362,7 +362,7 @@ describe('durable HTTP legacy activation', () => {
f.service.activate(f.taskId, async () => f.downloads)
).rejects.toThrow('legacyImport.errors.changedSource')
expect(f.adapter.resumeTask).not.toHaveBeenCalled()
- expect(await readFile(f.target)).toEqual(f.payload)
+ expect((await readFile(f.target)).equals(f.payload)).toBe(true)
})
it('holds the applied route stable until verification and native dispatch finish', async () => {
diff --git a/src/core/plugin/manifest/schema.test.ts b/src/core/plugin/manifest/schema.test.ts
deleted file mode 100644
index 203b8595..00000000
--- a/src/core/plugin/manifest/schema.test.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-// src/core/plugin/manifest/schema.test.ts
-import { describe, expect, it } from 'vitest'
-import { ManifestSchema } from './schema'
-
-const MINIMAL = {
- manifestVersion: 1,
- id: 'alice.demo',
- name: 'Demo',
- version: '1.0.0',
- description: 'd',
- categories: ['integration'],
- engines: { motrix: '>=2.0.0 <3.0.0' },
- main: 'dist/plugin.js',
- permissions: [],
- activationEvents: ['onStartup'],
- contributes: {},
-}
-
-describe('ManifestSchema', () => {
- it('accepts a minimal valid manifest', () => {
- expect(ManifestSchema.parse(MINIMAL)).toBeDefined()
- })
- it('rejects unknown top-level field', () => {
- expect(() => ManifestSchema.parse({ ...MINIMAL, foo: 1 })).toThrow()
- })
- it('rejects bad id format', () => {
- expect(() => ManifestSchema.parse({ ...MINIMAL, id: 'Bad.Id' })).toThrow()
- })
- it('accepts reserved publisher at the schema layer (parseManifest enforces by origin)', () => {
- // RESERVED_PUBLISHERS is no longer enforced inside ManifestSchema so that
- // built-in plugins (origin === 'builtin') can claim motrix.* ids. The
- // reservation is enforced in parseManifest based on origin.
- expect(ManifestSchema.parse({ ...MINIMAL, id: 'motrix.foo' })).toBeDefined()
- })
- it('rejects log/i18n in permissions (auto-injected)', () => {
- expect(() =>
- ManifestSchema.parse({ ...MINIMAL, permissions: ['log'] })
- ).toThrow()
- })
- it('passes through unknown contributes keys', () => {
- const m = ManifestSchema.parse({
- ...MINIMAL,
- contributes: { commands: [], themes: { foo: 'bar' } },
- })
- expect((m.contributes as Record<string, unknown>).themes).toEqual({
- foo: 'bar',
- })
- })
- it('rejects manifestVersion != 1', () => {
- expect(() =>
- ManifestSchema.parse({ ...MINIMAL, manifestVersion: 2 })
- ).toThrow()
- })
-})
diff --git a/src/main/plugin/hook-runtime-assembly.test.ts b/src/main/plugin/hook-runtime-assembly.test.ts
deleted file mode 100644
index bbc80b99..00000000
--- a/src/main/plugin/hook-runtime-assembly.test.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-import { readFileSync } from 'node:fs'
-import path from 'node:path'
-import { describe, expect, it } from 'vitest'
-
-function mainSource(): string {
- return readFileSync(path.resolve(process.cwd(), 'src/main/index.ts'), 'utf8')
-}
-
-describe('Electron plugin Hook runtime assembly', () => {
- it('injects every Hook service from one shared runtime instance', () => {
- const source = mainSource()
- expect(source).toContain(
- 'const pluginRuntime = await createPluginRuntime({'
- )
- expect(source).toContain('hookAuditLog = pluginRuntime.auditLog')
- expect(source).toContain('hookOrchestrator = pluginRuntime.orchestrator')
- expect(source).toContain('pluginHookRuntime = pluginRuntime.hooks')
- expect(source).toContain(
- 'finalizeFilesystemAdapter = pluginRuntime.finalizeFilesystem'
- )
- expect(source).toContain('durableFinalizeRuntime = pluginRuntime.finalize')
- })
-
- it('recovers and drains before opening producers', () => {
- const source = mainSource()
- const recover = source.indexOf('await pluginStartup.recoverFinalize(')
- const tasks = source.indexOf('pluginStartup.markTasksRecovered()')
- const drain = source.indexOf('await pluginStartup.drainBeforeProducers({')
- const scheduler = source.indexOf(
- 'postDeliveryLoop = activePluginHookRuntime.scheduler'
- )
- const producers = source.indexOf('pluginStartup.openProducers(() => {')
-
- expect(recover).toBeGreaterThan(-1)
- expect(recover).toBeLessThan(tasks)
- expect(tasks).toBeLessThan(drain)
- expect(drain).toBeLessThan(scheduler)
- expect(scheduler).toBeLessThan(producers)
- })
-
- it('aborts and drains post delivery before shutting down the Host', () => {
- const source = mainSource()
- const cleanup = source.slice(
- source.indexOf('cleanupPromise = (async () => {'),
- source.indexOf("await safely('magnet'")
- )
- const abort = cleanup.indexOf('postDeliveryAbortController?.abort()')
- const drain = cleanup.indexOf('await postDeliveryLoop')
- const shutdown = cleanup.indexOf('await host?.shutdown()')
-
- expect(abort).toBeGreaterThan(-1)
- expect(abort).toBeLessThan(drain)
- expect(drain).toBeLessThan(shutdown)
- })
-})
diff --git a/src/renderer/components/add-task/add-task-form.test.tsx b/src/renderer/components/add-task/add-task-form.test.tsx
index 46a15e0b..fc9fbafc 100644
--- a/src/renderer/components/add-task/add-task-form.test.tsx
+++ b/src/renderer/components/add-task/add-task-form.test.tsx
@@ -346,22 +346,6 @@ describe('AddTaskForm', () => {
expect(content?.parentElement).toHaveAttribute('tabindex', '-1')
})
- it('keeps the footer inside an in-page dialog', () => {
- const { container } = renderForm({ presentation: 'dialog' })
- const body = container.querySelector('[data-slot="add-task-form-body"]')
- const footer = container.querySelector('[data-slot="add-task-form-footer"]')
-
- expect(body).toHaveClass('min-h-0', 'flex-auto')
- expect(footer).not.toHaveClass('fixed', 'bottom-0', 'left-0')
- })
-
- it('keeps the footer fixed in the standalone Electron window', () => {
- const { container } = renderForm()
- const footer = container.querySelector('[data-slot="add-task-form-footer"]')
-
- expect(footer).toHaveClass('fixed', 'bottom-0', 'left-0')
- })
-
it('disables submit when urls are empty', () => {
renderForm()
const submit = screen.getByRole('button', { name: /download/i })
diff --git a/src/renderer/components/desktop-kit/cubic-glass/shaders.test.ts b/src/renderer/components/desktop-kit/cubic-glass/shaders.test.ts
deleted file mode 100644
index 42fa1ec5..00000000
--- a/src/renderer/components/desktop-kit/cubic-glass/shaders.test.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { describe, expect, it } from 'vitest'
-import {
- CUBIC_GLASS_FRAGMENT_SHADER,
- MAX_GRADIENT_BLOBS,
- MAX_GRADIENT_ENVELOPES,
-} from './shaders'
-
-describe('cubic glass shaders', () => {
- it('keeps shader array lengths in sync with the scene capacity', () => {
- expect(CUBIC_GLASS_FRAGMENT_SHADER).toContain(
- `uniform vec4 u_blob_geometry[${MAX_GRADIENT_BLOBS}]`
- )
- expect(CUBIC_GLASS_FRAGMENT_SHADER).toContain(
- `uniform vec4 u_envelope_geometry[${MAX_GRADIENT_ENVELOPES}]`
- )
- })
-})
diff --git a/src/renderer/components/desktop-kit/panel/panel-shell.test.tsx b/src/renderer/components/desktop-kit/panel/panel-shell.test.tsx
index 0fe91fc9..0d8097ff 100644
--- a/src/renderer/components/desktop-kit/panel/panel-shell.test.tsx
+++ b/src/renderer/components/desktop-kit/panel/panel-shell.test.tsx
@@ -6,16 +6,6 @@ import { describe, expect, it, vi } from 'vitest'
import { PanelShell } from './panel-shell'
describe('PanelShell', () => {
- it('renders title and children', () => {
- render(
- <PanelShell title="Trackers">
- <div>body</div>
- </PanelShell>
- )
- expect(screen.getByText('Trackers')).toBeInTheDocument()
- expect(screen.getByText('body')).toBeInTheDocument()
- })
-
it('forwards search edits and reflects the controlled value', async () => {
const user = userEvent.setup()
const onChange = vi.fn()
@@ -45,58 +35,4 @@ describe('PanelShell', () => {
expect(onChange).toHaveBeenLastCalledWith('tracker')
expect(input).toHaveValue('tracker')
})
-
- it('renders footer content when provided', () => {
- render(
- <PanelShell title="X" footer={<button type="button">go</button>}>
- <div />
- </PanelShell>
- )
- expect(screen.getByRole('button', { name: 'go' })).toBeInTheDocument()
- })
-})
-
-describe('PanelShell actionsPosition', () => {
- it('renders actions on the end side by default (after search)', () => {
- const { container } = render(
- <PanelShell
- title="T"
- search={{ value: '', onChange: () => {}, placeholder: 'p' }}
- actions={
- <button type="button" data-testid="act">
- a
- </button>
- }
- >
- <div>content</div>
- </PanelShell>
- )
- const searchInput = container.querySelector('input')
- const btn = container.querySelector('[data-testid=act]') as HTMLElement
- expect(searchInput?.compareDocumentPosition(btn)).toBe(
- Node.DOCUMENT_POSITION_FOLLOWING
- )
- })
-
- it('renders actions on the start side when actionsPosition is "start"', () => {
- const { container } = render(
- <PanelShell
- title="T"
- search={{ value: '', onChange: () => {}, placeholder: 'p' }}
- actions={
- <button type="button" data-testid="act">
- a
- </button>
- }
- actionsPosition="start"
- >
- <div>content</div>
- </PanelShell>
- )
- const searchInput = container.querySelector('input')
- const btn = container.querySelector('[data-testid=act]') as HTMLElement
- expect(btn.compareDocumentPosition(searchInput as Node)).toBe(
- Node.DOCUMENT_POSITION_FOLLOWING
- )
- })
})
diff --git a/src/renderer/components/task/task-status-badge.test.tsx b/src/renderer/components/task/task-status-badge.test.tsx
deleted file mode 100644
index 0ec24792..00000000
--- a/src/renderer/components/task/task-status-badge.test.tsx
+++ /dev/null
@@ -1,28 +0,0 @@
-import { render, screen } from '@testing-library/react'
-import { describe, expect, it } from 'vitest'
-import '@testing-library/jest-dom/vitest'
-import '@renderer/lib/i18n'
-import { TaskStatus } from '@shared/types/task'
-import { TaskStatusBadge } from './task-status-badge'
-
-describe('TaskStatusBadge', () => {
- it('renders every TaskStatus value without throwing', () => {
- for (const status of Object.values(TaskStatus)) {
- const { unmount } = render(<TaskStatusBadge status={status} />)
- expect(screen.getByTestId('task-status-badge-icon')).toBeInTheDocument()
- unmount()
- }
- })
-
- it('renders the Finalizing status with a spinning Loader2 icon', () => {
- render(<TaskStatusBadge status={TaskStatus.Finalizing} />)
- expect(screen.getByText('Finalizing…')).toBeInTheDocument()
- const icon = screen.getByTestId('task-status-badge-icon')
- expect(icon).toHaveClass('animate-spin')
- })
-
- it('labels non-finalizing statuses with the lowercased enum value', () => {
- render(<TaskStatusBadge status={TaskStatus.Downloading} />)
- expect(screen.getByText('downloading')).toBeInTheDocument()
- })
-})
diff --git a/src/renderer/components/window-chrome/add-task-trigger-button.test.tsx b/src/renderer/components/window-chrome/add-task-trigger-button.test.tsx
index 63d941b4..531587bf 100644
--- a/src/renderer/components/window-chrome/add-task-trigger-button.test.tsx
+++ b/src/renderer/components/window-chrome/add-task-trigger-button.test.tsx
@@ -56,13 +56,4 @@ describe('AddTaskTriggerButton', () => {
})
expect(openMock).not.toHaveBeenCalled()
})
-
- it('shares the window-chrome icon opacity treatment', () => {
- renderWithProviders()
- expect(screen.getByRole('button', { name: /new task/i })).toHaveClass(
- '[&>svg]:opacity-65',
- 'hover:[&>svg]:opacity-90',
- 'focus-visible:[&>svg]:opacity-90'
- )
- })
})
diff --git a/src/renderer/components/window-chrome/sidebar-trigger-button.test.tsx b/src/renderer/components/window-chrome/sidebar-trigger-button.test.tsx
index 3e9f6c8a..8ebfa7d6 100644
--- a/src/renderer/components/window-chrome/sidebar-trigger-button.test.tsx
+++ b/src/renderer/components/window-chrome/sidebar-trigger-button.test.tsx
@@ -71,13 +71,4 @@ describe('SidebarTriggerButton', () => {
'Toggle sidebar'
)
})
-
- it('shares the window-chrome icon opacity treatment', () => {
- renderWithProviders()
- expect(screen.getByRole('button', { name: /toggle sidebar/i })).toHaveClass(
- '[&>svg]:opacity-65',
- 'hover:[&>svg]:opacity-90',
- 'focus-visible:[&>svg]:opacity-90'
- )
- })
})
diff --git a/src/renderer/components/window-chrome/window-chrome.test.tsx b/src/renderer/components/window-chrome/window-chrome.test.tsx
index 59012545..02938b03 100644
--- a/src/renderer/components/window-chrome/window-chrome.test.tsx
+++ b/src/renderer/components/window-chrome/window-chrome.test.tsx
@@ -446,32 +446,6 @@ describe('WindowChrome', () => {
expect(screen.getByRole('button', { name: 'Maximize' })).toBeVisible()
})
- it('uses theme-aware caption colors with a readable destructive hover', () => {
- setPlatform('win32')
- render(<WindowChrome variant="overlay" />)
-
- const minimize = screen.getByRole('button', { name: 'Minimize' })
- const close = screen.getByRole('button', { name: 'Close' })
-
- expect(minimize).toHaveClass(
- 'text-foreground',
- '[&>svg]:opacity-65',
- 'hover:bg-accent',
- 'hover:text-accent-foreground',
- 'hover:[&>svg]:opacity-90',
- 'dark:hover:bg-accent/50'
- )
- expect(close).toHaveClass(
- 'text-foreground',
- '[&>svg]:opacity-65',
- 'hover:bg-destructive',
- 'hover:text-white',
- 'hover:[&>svg]:opacity-100',
- 'dark:hover:bg-destructive/80'
- )
- expect(close).not.toHaveClass('hover:text-destructive-foreground')
- })
-
it.each(['win32'] as const)(
'routes %s caption controls to sender-bound window commands',
(platform) => {
@@ -503,26 +477,4 @@ describe('WindowChrome', () => {
expect(screen.getByRole('button', { name: 'Maximize' })).toBeDisabled()
})
-
- it('aligns app and caption controls on the shared compact baseline', () => {
- setPlatform('win32')
- const { container } = render(
- <WindowChrome
- variant="overlay"
- leading={<button type="button">Menu</button>}
- >
- <button type="button">Action</button>
- </WindowChrome>
- )
-
- expect(
- container.querySelector('[data-slot="window-chrome-leading"]')
- ).toHaveClass('pt-3.5')
- expect(
- container.querySelector('[data-slot="window-chrome-actions"]')
- ).toHaveClass('pt-3.5')
- expect(
- container.querySelector('[data-slot="desktop-window-controls"]')
- ).toHaveClass('pt-3.5')
- })
})
diff --git a/src/renderer/layouts/app-layout.test.tsx b/src/renderer/layouts/app-layout.test.tsx
index dd84960f..306c6d51 100644
--- a/src/renderer/layouts/app-layout.test.tsx
+++ b/src/renderer/layouts/app-layout.test.tsx
@@ -195,18 +195,6 @@ describe('AppLayout', () => {
).not.toBeNull()
})
- it('keeps the sidebar-wrapper background in mobile mode', () => {
- // Below the 768px breakpoint the Sidebar renders as a portaled Sheet
- // without data-variant="inset", so the wrapper's conditional
- // `has-data-[variant=inset]:bg-sidebar` never matches. The wrapper
- // must carry an unconditional bg-sidebar or transparent-inset pages
- // (Dashboard) lose their background contrast.
- setWindowWidth(500)
- renderAppLayout()
- const wrapper = document.querySelector('[data-slot="sidebar-wrapper"]')
- expect(wrapper).toHaveClass('bg-sidebar')
- })
-
it('reports data-state=collapsed in mobile mode regardless of open flag', () => {
// Below the md breakpoint the docked sidebar cannot be visible, so the
// wrapper must report collapsed even when the desktop `open` flag is
@@ -219,30 +207,6 @@ describe('AppLayout', () => {
expect(wrapper).toHaveAttribute('data-state', 'collapsed')
})
- it('keeps the inset card look below the md breakpoint', () => {
- // Upstream shadcn gates m-2/rounded-xl/shadow-sm behind
- // md:peer-data-[variant=inset]:, which both stops matching below
- // 768px (the peer div is not rendered in mobile mode). We want the
- // rounded card to survive at narrow widths, so the classes must be
- // unconditional.
- setWindowWidth(500)
- renderAppLayout()
- const inset = document.querySelector('[data-slot="sidebar-inset"]')
- expect(inset).toHaveClass('m-2', 'rounded-xl', 'shadow-sm')
- })
-
- it('leaves no shadow-producing class on a transparentInset route', () => {
- // The built-in SidebarInset shadow is md:peer-data-[variant=inset]:
- // shadow-sm. tailwind-merge only collapses classes with identical
- // modifiers, so the transparent branch must suppress BOTH the
- // unconditional shadow-sm and the md-variant one — a bare shadow-none
- // leaves the built-in variant alive at desktop widths.
- renderAppLayout({ transparentInset: true })
- const inset = document.querySelector('[data-slot="sidebar-inset"]')
- expect(inset?.className).not.toMatch(/shadow-sm/)
- expect(inset).toHaveClass('bg-transparent')
- })
-
it('renders the sidebar and the current route outlet', () => {
renderAppLayout()
// Sidebar nav items
diff --git a/src/renderer/lib/browser-name.test.ts b/src/renderer/lib/browser-name.test.ts
deleted file mode 100644
index 6891d0d7..00000000
--- a/src/renderer/lib/browser-name.test.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { describe, expect, it } from 'vitest'
-import { browserDisplayName } from './browser-name'
-
-describe('browserDisplayName', () => {
- it('names each browser family the way every surface must', () => {
- expect(browserDisplayName('chromium')).toBe('Chrome / Edge')
- expect(browserDisplayName('firefox')).toBe('Firefox')
- expect(browserDisplayName('safari')).toBe('Safari')
- })
-})
diff --git a/src/renderer/lib/task-type-meta.test.ts b/src/renderer/lib/task-type-meta.test.ts
deleted file mode 100644
index 4ad81822..00000000
--- a/src/renderer/lib/task-type-meta.test.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { TaskType } from '@shared/types/task'
-import { describe, expect, it } from 'vitest'
-import { TASK_TYPE_META, TASK_TYPE_ORDER } from './task-type-meta'
-
-describe('task type metadata', () => {
- it('defines one localized glyph for every task type', () => {
- for (const type of Object.values(TaskType)) {
- expect(TASK_TYPE_META[type]).toBeDefined()
- expect(TASK_TYPE_META[type].labelKey).toMatch(/^panel\.downloads\.type\./)
- }
- })
-
- it('keeps the filter order exhaustive and unique', () => {
- expect(new Set(TASK_TYPE_ORDER)).toEqual(new Set(Object.values(TaskType)))
- expect(TASK_TYPE_ORDER).toHaveLength(Object.values(TaskType).length)
- })
-})
diff --git a/src/renderer/routes/dashboard/components/dashboard-resize-ghost.test.tsx b/src/renderer/routes/dashboard/components/dashboard-resize-ghost.test.tsx
index d2bf06cb..e0db224c 100644
--- a/src/renderer/routes/dashboard/components/dashboard-resize-ghost.test.tsx
+++ b/src/renderer/routes/dashboard/components/dashboard-resize-ghost.test.tsx
@@ -4,63 +4,6 @@ import { describe, expect, it } from 'vitest'
import { DashboardResizeGhost } from './dashboard-resize-ghost'
describe('DashboardResizeGhost', () => {
- it('maps its geometry to the dashboard grid and stays non-interactive', () => {
- render(
- <DashboardResizeGhost
- geometry={{ x: 1, y: 0, w: 3, h: 2 }}
- valid
- sizeLabel="Current size: 3 × 2"
- />
- )
-
- const ghost = screen.getByTestId('dashboard-resize-ghost')
- expect(ghost).toHaveStyle({
- '--dashboard-grid-column': '2 / span 3',
- '--dashboard-grid-row': '1 / span 2',
- })
- expect(ghost).toHaveClass(
- 'pointer-events-none',
- 'hidden',
- '@[560px]:flex',
- '@[560px]:[grid-column:var(--dashboard-grid-column)]',
- '@[560px]:[grid-row:var(--dashboard-grid-row)]'
- )
- })
-
- it('uses a fixed viewport rect while retaining snapped grid geometry', () => {
- render(
- <DashboardResizeGhost
- geometry={{ x: 3, y: 2, w: 2, h: 2 }}
- viewportRect={{
- left: 300,
- top: 256,
- width: 200,
- height: 256,
- }}
- valid={false}
- sizeLabel="Current size: 2 × 2"
- failure="Not enough space"
- />
- )
-
- const ghost = screen.getByTestId('dashboard-resize-ghost')
- expect(ghost).toHaveClass('fixed', 'z-40')
- expect(ghost).not.toHaveClass(
- 'absolute',
- 'inset-0',
- '@[560px]:[grid-column:var(--dashboard-grid-column)]',
- '@[560px]:[grid-row:var(--dashboard-grid-row)]'
- )
- expect(ghost).toHaveStyle({
- '--dashboard-grid-column': '4 / span 2',
- '--dashboard-grid-row': '3 / span 2',
- left: '300px',
- top: '256px',
- width: '200px',
- height: '256px',
- })
- })
-
it('uses the primary treatment for a valid preview', () => {
render(
<DashboardResizeGhost
diff --git a/src/renderer/routes/dashboard/components/kpi-number.test.tsx b/src/renderer/routes/dashboard/components/kpi-number.test.tsx
index e7bef35e..c6d23cdd 100644
--- a/src/renderer/routes/dashboard/components/kpi-number.test.tsx
+++ b/src/renderer/routes/dashboard/components/kpi-number.test.tsx
@@ -35,19 +35,4 @@ describe('KpiNumber', () => {
expect(el).toHaveAttribute('title', '12345678901234567890 MB/s')
expect(el).toHaveTextContent('12345678901234567890 MB/s')
})
-
- it.each([
- { variant: 'inherit' as const, className: undefined },
- { variant: 'compact' as const, className: undefined },
- { variant: 'inherit' as const, className: 'text-[22px]' },
- ])(
- 'preserves the line height when merging $variant with $className',
- ({ variant, className }) => {
- const { container } = render(
- <KpiNumber value="42 MB" variant={variant} className={className} />
- )
-
- expect(container.firstElementChild).toHaveClass('leading-none')
- }
- )
})
diff --git a/src/renderer/routes/dashboard/components/status-dot.test.tsx b/src/renderer/routes/dashboard/components/status-dot.test.tsx
deleted file mode 100644
index a67b6d0b..00000000
--- a/src/renderer/routes/dashboard/components/status-dot.test.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import '@testing-library/jest-dom/vitest'
-import { render } from '@testing-library/react'
-import { describe, expect, it } from 'vitest'
-import { StatusDot } from './status-dot'
-
-describe('StatusDot', () => {
- it('marks an active dot for the pulse animation', () => {
- const { container } = render(
- <StatusDot pulse className="size-2 bg-emerald-500" />
- )
- const dot = container.querySelector('[data-slot="status-dot"]')
-
- expect(dot).toHaveAttribute('data-pulse', 'true')
- expect(dot).toHaveAttribute('aria-hidden', 'true')
- expect(dot).toHaveClass('size-2', 'bg-emerald-500')
- })
-
- it('keeps an inactive dot still', () => {
- const { container } = render(<StatusDot className="bg-gray-500" />)
- const dot = container.querySelector('[data-slot="status-dot"]')
-
- expect(dot).not.toHaveAttribute('data-pulse')
- })
-})
diff --git a/src/renderer/routes/dashboard/components/tile-shell.test.tsx b/src/renderer/routes/dashboard/components/tile-shell.test.tsx
deleted file mode 100644
index fe7208dd..00000000
--- a/src/renderer/routes/dashboard/components/tile-shell.test.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import '@testing-library/jest-dom/vitest'
-import { render, screen } from '@testing-library/react'
-import { describe, expect, it } from 'vitest'
-import { TileShell } from './tile-shell'
-
-describe('TileShell', () => {
- it('renders header label and body slot', () => {
- render(
- <TileShell label="UPLOAD">
- <span data-testid="body">hello</span>
- </TileShell>
- )
- expect(screen.getByText('UPLOAD')).toBeInTheDocument()
- expect(screen.getByTestId('body')).toBeInTheDocument()
- })
-
- it('renders an action slot when provided', () => {
- render(
- <TileShell label="ENGINE" action={<button type="button">Diag</button>}>
- <span />
- </TileShell>
- )
- expect(screen.getByRole('button', { name: 'Diag' })).toBeInTheDocument()
- })
-
- it('forwards bodyClassName to the body container', () => {
- const { container } = render(
- <TileShell label="X" bodyClassName="test-body">
- <span />
- </TileShell>
- )
- expect(container.querySelector('.test-body')).toBeInTheDocument()
- })
-})
diff --git a/src/renderer/routes/dashboard/components/tile-title.test.tsx b/src/renderer/routes/dashboard/components/tile-title.test.tsx
deleted file mode 100644
index 3b8d7848..00000000
--- a/src/renderer/routes/dashboard/components/tile-title.test.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-import '@testing-library/jest-dom/vitest'
-import { render } from '@testing-library/react'
-import { describe, expect, expectTypeOf, it } from 'vitest'
-import { TileTitle, type TileTitleProps } from './tile-title'
-
-type MetricTileTitleProps = Extract<TileTitleProps, { variant?: 'metric' }>
-
-type HasRawHtmlProp = 'dangerouslySetInnerHTML' extends keyof TileTitleProps
- ? true
- : false
-
-describe('TileTitle', () => {
- it('renders a text title', () => {
- const { container } = render(<TileTitle variant="text">Ready</TileTitle>)
- const title = container.querySelector('[data-slot="tile-title"]')
-
- expect(title).toHaveTextContent('Ready')
- })
-
- it('renders a metric title through KpiNumber', () => {
- const { container } = render(<TileTitle value="42 MB" />)
- const title = container.querySelector<HTMLElement>(
- '[data-slot="tile-title"]'
- )
- const kpi = container.querySelector<HTMLElement>('[data-slot="kpi-number"]')
-
- expect(title).toContainElement(kpi)
- expect(title).toHaveTextContent('42 MB')
- })
-
- it('keeps the metric and text content contracts closed', () => {
- expectTypeOf<MetricTileTitleProps['value']>().toEqualTypeOf<
- string | number
- >()
- expectTypeOf<MetricTileTitleProps['children']>().toEqualTypeOf<undefined>()
- expectTypeOf<HasRawHtmlProp>().toEqualTypeOf<false>()
- })
-
- it('passes non-visual div attributes without exposing geometry overrides', () => {
- const { container } = render(
- <TileTitle variant="text" title="Complete state label">
- Custom
- </TileTitle>
- )
- const title = container.querySelector('[data-slot="tile-title"]')
-
- expect(title).toHaveAttribute('title', 'Complete state label')
- expect(title).not.toHaveAttribute('style')
- })
-})
diff --git a/src/renderer/routes/dashboard/layout/dashboard-presets.test.ts b/src/renderer/routes/dashboard/layout/dashboard-presets.test.ts
index f2c4e046..0f612e50 100644
--- a/src/renderer/routes/dashboard/layout/dashboard-presets.test.ts
+++ b/src/renderer/routes/dashboard/layout/dashboard-presets.test.ts
@@ -10,7 +10,6 @@ import type {
import { beforeEach, describe, expect, it, vi } from 'vitest'
import {
applyDashboardPreset,
- DASHBOARD_LAYOUT_PRESET_BY_ID,
DASHBOARD_LAYOUT_PRESETS,
type DashboardLayoutPresetId,
getDashboardLayoutPreset,
@@ -29,55 +28,6 @@ vi.mock('./dashboard-layout', () => ({
packDashboardLayout: packDashboardLayoutMock,
}))
-const EXPECTED_TILES: Record<DashboardLayoutPresetId, DashboardTileLayout[]> = {
- balanced: [
- { id: 'engine', enabled: true, x: 0, y: 0, w: 1, h: 1 },
- { id: 'speedLimit', enabled: true, x: 1, y: 0, w: 1, h: 1 },
- { id: 'speedUp', enabled: true, x: 2, y: 0, w: 1, h: 1 },
- { id: 'speedDown', enabled: true, x: 3, y: 0, w: 1, h: 1 },
- { id: 'active', enabled: true, x: 0, y: 1, w: 2, h: 1 },
- { id: 'transfer', enabled: true, x: 2, y: 1, w: 2, h: 1 },
- { id: 'activity', enabled: true, x: 0, y: 2, w: 4, h: 1 },
- { id: 'tasks', enabled: false, x: 2, y: 1, w: 2, h: 2 },
- { id: 'nat', enabled: false, x: 0, y: 0, w: 1, h: 1 },
- ],
- taskFocus: [
- { id: 'engine', enabled: true, x: 0, y: 0, w: 1, h: 1 },
- { id: 'speedLimit', enabled: true, x: 1, y: 0, w: 1, h: 1 },
- { id: 'active', enabled: true, x: 2, y: 0, w: 1, h: 1 },
- { id: 'transfer', enabled: true, x: 3, y: 0, w: 1, h: 1 },
- { id: 'speedUp', enabled: true, x: 0, y: 1, w: 1, h: 1 },
- { id: 'tasks', enabled: true, x: 1, y: 1, w: 3, h: 2 },
- { id: 'speedDown', enabled: true, x: 0, y: 2, w: 1, h: 1 },
- { id: 'nat', enabled: false, x: 0, y: 0, w: 1, h: 1 },
- { id: 'activity', enabled: false, x: 0, y: 0, w: 1, h: 1 },
- ],
- speedFocus: [
- { id: 'speedDown', enabled: true, x: 0, y: 0, w: 2, h: 2 },
- { id: 'speedUp', enabled: true, x: 2, y: 0, w: 2, h: 2 },
- { id: 'engine', enabled: true, x: 0, y: 2, w: 1, h: 1 },
- { id: 'speedLimit', enabled: true, x: 1, y: 2, w: 1, h: 1 },
- { id: 'transfer', enabled: true, x: 2, y: 2, w: 2, h: 1 },
- { id: 'tasks', enabled: false, x: 0, y: 0, w: 2, h: 2 },
- { id: 'active', enabled: false, x: 0, y: 0, w: 1, h: 1 },
- { id: 'nat', enabled: false, x: 0, y: 0, w: 1, h: 1 },
- { id: 'activity', enabled: false, x: 0, y: 0, w: 1, h: 1 },
- ],
- compact: [
- { id: 'engine', enabled: true, x: 0, y: 0, w: 1, h: 1 },
- { id: 'nat', enabled: true, x: 1, y: 0, w: 1, h: 1 },
- { id: 'speedUp', enabled: true, x: 2, y: 0, w: 1, h: 1 },
- { id: 'speedDown', enabled: true, x: 3, y: 0, w: 1, h: 1 },
- { id: 'speedLimit', enabled: true, x: 0, y: 1, w: 1, h: 1 },
- { id: 'transfer', enabled: true, x: 1, y: 1, w: 1, h: 1 },
- { id: 'tasks', enabled: true, x: 2, y: 1, w: 2, h: 1 },
- { id: 'active', enabled: true, x: 0, y: 2, w: 2, h: 1 },
- { id: 'activity', enabled: true, x: 2, y: 2, w: 2, h: 1 },
- ],
-}
-
-const PRESET_IDS = Object.keys(EXPECTED_TILES) as DashboardLayoutPresetId[]
-
const TILE_FIELD_MUTATIONS: {
name: string
mutate: (tile: DashboardTileLayout) => void
@@ -171,29 +121,7 @@ describe('dashboard layout presets', () => {
packDashboardLayoutMock.mockClear()
})
- it.each(PRESET_IDS)('defines the exact ordered %s table', (id) => {
- expect(getDashboardLayoutPreset(id).layout).toEqual({
- version: 1,
- columns: DASHBOARD_COLUMNS,
- tiles: EXPECTED_TILES[id],
- })
- })
-
- it('exports all four presets in their canonical menu order', () => {
- expect(DASHBOARD_LAYOUT_PRESETS.map((preset) => preset.id)).toEqual([
- 'balanced',
- 'taskFocus',
- 'speedFocus',
- 'compact',
- ])
-
- for (const preset of DASHBOARD_LAYOUT_PRESETS) {
- expect(DASHBOARD_LAYOUT_PRESET_BY_ID.get(preset.id)).toBe(preset)
- expect(getDashboardLayoutPreset(preset.id)).toBe(preset)
- }
- })
-
- it.each(PRESET_IDS)(
+ it.each(DASHBOARD_LAYOUT_PRESETS.map((preset) => preset.id))(
'keeps %s complete, supported, ordered, and inside the fixed canvas',
(id) => {
expectValidPreset(getDashboardLayoutPreset(id).layout)
@@ -228,8 +156,8 @@ describe('dashboard layout presets', () => {
const arbitraryCurrent: DashboardLayoutSettings = {
version: 1,
columns: DASHBOARD_COLUMNS,
- tiles: EXPECTED_TILES.compact
- .toReversed()
+ tiles: getDashboardLayoutPreset('compact')
+ .layout.tiles.toReversed()
.map((tile) => ({ ...tile, enabled: false, x: 0, y: 0 })),
}
@@ -241,9 +169,12 @@ describe('dashboard layout presets', () => {
expect(packDashboardLayoutMock).not.toHaveBeenCalled()
})
- it.each(PRESET_IDS)('matches the exact %s preset', (id) => {
- expect(matchDashboardPreset(applyDashboardPreset(id))).toBe(id)
- })
+ it.each(DASHBOARD_LAYOUT_PRESETS.map((preset) => preset.id))(
+ 'matches the exact %s preset',
+ (id) => {
+ expect(matchDashboardPreset(applyDashboardPreset(id))).toBe(id)
+ }
+ )
it.each(TILE_FIELD_MUTATIONS)(
'returns null when tile $name differs',
diff --git a/src/renderer/routes/dashboard/layout/dashboard-registry.test.ts b/src/renderer/routes/dashboard/layout/dashboard-registry.test.ts
index a415ea32..ca2e8864 100644
--- a/src/renderer/routes/dashboard/layout/dashboard-registry.test.ts
+++ b/src/renderer/routes/dashboard/layout/dashboard-registry.test.ts
@@ -3,7 +3,6 @@ import {
DASHBOARD_ROWS,
DEFAULT_DASHBOARD_LAYOUT,
} from '@shared/schemas/dashboard-layout'
-import type { DashboardTileId } from '@shared/types/settings'
import { describe, expect, it } from 'vitest'
import {
DASHBOARD_TILE_DEFINITION_BY_ID,
@@ -14,86 +13,10 @@ import {
dashboardTileViewport,
getDashboardTileDefinition,
getDashboardTilePresentation,
- getDashboardTilePresentations,
nearestDashboardTilePresentation,
normalizeDashboardTilePresentation,
} from './dashboard-registry'
-const EXPECTED_PRESENTATIONS = {
- engine: [
- ['1x1', 'compact'],
- ['2x1', 'summary'],
- ['1x2', 'detailed'],
- ['2x2', 'detailed'],
- ],
- speedLimit: [
- ['1x1', 'compact'],
- ['2x1', 'summary'],
- ['1x2', 'detailed'],
- ['2x2', 'detailed'],
- ],
- speedUp: [
- ['1x1', 'compact'],
- ['2x1', 'summary'],
- ['3x1', 'detailed'],
- ['4x1', 'focus'],
- ['2x2', 'detailed'],
- ['3x2', 'focus'],
- ],
- speedDown: [
- ['1x1', 'compact'],
- ['2x1', 'summary'],
- ['3x1', 'detailed'],
- ['4x1', 'focus'],
- ['2x2', 'detailed'],
- ['3x2', 'focus'],
- ],
- active: [
- ['1x1', 'compact'],
- ['2x1', 'summary'],
- ['2x2', 'detailed'],
- ['4x1', 'focus'],
- ],
- transfer: [
- ['1x1', 'compact'],
- ['2x1', 'summary'],
- ['1x2', 'detailed'],
- ['2x2', 'detailed'],
- ['4x1', 'focus'],
- ],
- tasks: [
- ['2x1', 'summary'],
- ['2x2', 'detailed'],
- ['2x3', 'focus'],
- ['3x2', 'focus'],
- ['3x3', 'focus'],
- ['4x2', 'focus'],
- ],
- nat: [
- ['1x1', 'compact'],
- ['2x1', 'summary'],
- ['1x2', 'detailed'],
- ['2x2', 'detailed'],
- ['2x3', 'focus'],
- ],
- activity: [
- ['1x1', 'compact'],
- ['2x1', 'summary'],
- ['3x1', 'detailed'],
- ['4x1', 'focus'],
- ['2x2', 'detailed'],
- ['3x2', 'focus'],
- ['4x2', 'focus'],
- ],
-} as const
-
-function presentationPairs(id: DashboardTileId) {
- return getDashboardTilePresentations(id).map((presentation) => [
- dashboardTileSpanKey(presentation.span),
- presentation.contentLevel,
- ])
-}
-
describe('dashboard-registry', () => {
it('defines every known tile exactly once in default order', () => {
const ids = DASHBOARD_TILE_DEFINITIONS.map((definition) => definition.id)
@@ -103,12 +26,6 @@ describe('dashboard-registry', () => {
expect(DASHBOARD_TILE_DEFINITION_BY_ID).toHaveProperty('size', ids.length)
})
- it('matches the exact presentation capability matrix', () => {
- for (const [id, expected] of Object.entries(EXPECTED_PRESENTATIONS)) {
- expect(presentationPairs(id as DashboardTileId)).toEqual(expected)
- }
- })
-
it('declares each shared default span as a supported presentation', () => {
for (const tile of DEFAULT_DASHBOARD_LAYOUT.tiles) {
const definition = getDashboardTileDefinition(tile.id)
diff --git a/src/renderer/routes/dashboard/tiles/active-tile.test.tsx b/src/renderer/routes/dashboard/tiles/active-tile.test.tsx
index 49cc4a62..572ce5da 100644
--- a/src/renderer/routes/dashboard/tiles/active-tile.test.tsx
+++ b/src/renderer/routes/dashboard/tiles/active-tile.test.tsx
@@ -23,7 +23,6 @@ const { ActiveTile } = await import('./active-tile')
const compactViewport = dashboardTileViewport('active', { w: 1, h: 1 })
const summaryViewport = dashboardTileViewport('active', { w: 2, h: 1 })
const detailedViewport = dashboardTileViewport('active', { w: 2, h: 2 })
-const focusViewport = dashboardTileViewport('active', { w: 4, h: 1 })
describe('ActiveTile', () => {
it('keeps the primary count above the breakdown in summary', () => {
@@ -74,15 +73,4 @@ describe('ActiveTile', () => {
)
expect(screen.getByTestId('active-content')).toHaveClass('flex-col')
})
-
- it('keeps the KPI above a four-column breakdown in focus content', () => {
- render(<ActiveTile activeCount={4} viewport={focusViewport} />)
-
- expect(screen.getByText(/Error|错误/i)).toBeInTheDocument()
- expect(screen.getByTestId('active-breakdown')).toHaveClass('grid-cols-4')
- expect(screen.getByTestId('active-content')).toHaveClass(
- 'flex-col',
- 'justify-between'
- )
- })
})
diff --git a/src/renderer/routes/dashboard/tiles/engine-tile.test.tsx b/src/renderer/routes/dashboard/tiles/engine-tile.test.tsx
index 467d2ba2..933c7791 100644
--- a/src/renderer/routes/dashboard/tiles/engine-tile.test.tsx
+++ b/src/renderer/routes/dashboard/tiles/engine-tile.test.tsx
@@ -136,19 +136,4 @@ describe('EngineTile', () => {
)
expect(screen.getByTestId('engine-footer')).toHaveClass('flex-col')
})
-
- it('keeps the compact failed-state action subtle with a destructive icon', () => {
- render(
- <EngineTile
- status={{ ...baseStatus, state: 'failed' }}
- viewport={compactViewport}
- />
- )
- const diagnoseButton = screen.getByRole('button', {
- name: /Diagnose|诊断/i,
- })
-
- expect(diagnoseButton).toHaveAttribute('data-variant', 'ghost')
- expect(diagnoseButton.querySelector('svg')).toHaveClass('text-destructive')
- })
})
diff --git a/src/renderer/routes/dashboard/tiles/nat-tile.test.tsx b/src/renderer/routes/dashboard/tiles/nat-tile.test.tsx
index e1fe076a..9b4d6589 100644
--- a/src/renderer/routes/dashboard/tiles/nat-tile.test.tsx
+++ b/src/renderer/routes/dashboard/tiles/nat-tile.test.tsx
@@ -279,19 +279,6 @@ describe('NatTile', () => {
)
})
- it('stacks diagnostic fields in one column in the narrow tall presentation', () => {
- render(<NatTile viewport={TALL_DETAILED} />)
-
- expect(screen.getByTestId('nat-details')).toHaveClass('grid-cols-1')
- expect(screen.getByTestId('nat-details')).toHaveAttribute(
- 'data-orientation',
- 'tall'
- )
- expect(screen.getByTestId('nat-metric-external-ip')).toHaveClass(
- 'col-span-full'
- )
- })
-
it.each([SUMMARY, TALL_DETAILED, SQUARE_DETAILED, FOCUS])(
'replaces stale diagnostic fields with a quiet empty state when off in $contentLevel',
(viewport) => {
@@ -384,29 +371,6 @@ describe('NatTile', () => {
)
})
- it('wraps long network values instead of hiding their content', () => {
- const ipv6 = '2001:db8:85a3:0000:0000:8a2e:0370:7334'
- natState.status = makeStatus({
- gatewayInfo: {
- internalIp: 'fd00::2',
- gatewayIp: 'fd00::1',
- externalIp: ipv6,
- controlUrl: null,
- controlHost: null,
- controlPort: null,
- manufacturer: null,
- modelName: null,
- supportedProtocols: [],
- },
- })
-
- render(<NatTile viewport={TALL_DETAILED} />)
-
- expect(screen.getByText(ipv6)).toHaveClass('break-all')
- expect(screen.getByText(ipv6)).not.toHaveClass('truncate')
- expect(screen.getByText(ipv6)).toHaveAttribute('title', ipv6)
- })
-
it('disables NAT from the menu when running', async () => {
render(<NatTile viewport={COMPACT} />)
fireEvent.click(screen.getByRole('button', { name: 'NAT controls' }))
diff --git a/src/renderer/routes/dashboard/tiles/tasks-tile.fixture.test.ts b/src/renderer/routes/dashboard/tiles/tasks-tile.fixture.test.ts
deleted file mode 100644
index 57ce429d..00000000
--- a/src/renderer/routes/dashboard/tiles/tasks-tile.fixture.test.ts
+++ /dev/null
@@ -1,89 +0,0 @@
-import { TaskStatus, TaskType } from '@shared/types/task'
-import { describe, expect, it } from 'vitest'
-import {
- getTasksTileFixture,
- resolveTasksTileFixture,
- TASKS_TILE_FIXTURE_NAMES,
- TASKS_TILE_FIXTURES,
-} from './tasks-tile.fixture'
-
-describe('Tasks tile development fixtures', () => {
- it('exposes every required deterministic state', () => {
- expect(TASKS_TILE_FIXTURE_NAMES).toEqual([
- 'active-all',
- 'history',
- 'loading',
- 'initial-error',
- 'cached-error',
- 'empty',
- 'offline',
- 'long-content',
- ])
- expect(TASKS_TILE_FIXTURES.loading.source).toMatchObject({
- status: 'loading',
- hasReadySnapshot: false,
- })
- expect(TASKS_TILE_FIXTURES['initial-error'].source).toMatchObject({
- status: 'error',
- hasReadySnapshot: false,
- })
- expect(TASKS_TILE_FIXTURES['cached-error'].source).toMatchObject({
- status: 'error',
- hasReadySnapshot: true,
- })
- expect(TASKS_TILE_FIXTURES.offline.engineOnline).toBe(false)
- expect(
- TASKS_TILE_FIXTURES.offline.source.tasks.some(
- (task) => task.status === TaskStatus.Error
- )
- ).toBe(true)
- expect(
- TASKS_TILE_FIXTURES.offline.source.tasks.some(
- (task) => task.status === TaskStatus.Completed
- )
- ).toBe(true)
- })
-
- it('covers every Active status and mixed task types', () => {
- const tasks = TASKS_TILE_FIXTURES['active-all'].source.tasks
- expect(new Set(tasks.map((task) => task.status))).toEqual(
- new Set([
- TaskStatus.Queued,
- TaskStatus.FetchingMetadata,
- TaskStatus.MetadataReady,
- TaskStatus.Downloading,
- TaskStatus.Finalizing,
- TaskStatus.Seeding,
- TaskStatus.Paused,
- ])
- )
- expect(new Set(tasks.map((task) => task.type)).size).toBeGreaterThan(3)
- expect(tasks.some((task) => task.type === TaskType.Metalink)).toBe(true)
- })
-
- it('covers long content, missing failure copy, and large values', () => {
- const longContent = TASKS_TILE_FIXTURES['long-content'].source.tasks
- const history = TASKS_TILE_FIXTURES.history.source.tasks
-
- expect(longContent.some((task) => task.name.length > 100)).toBe(true)
- expect(
- history.some(
- (task) => task.status === TaskStatus.Error && !task.errorMessage
- )
- ).toBe(true)
- expect(
- history.some((task) => task.sizeWhenDone === Number.MAX_SAFE_INTEGER)
- ).toBe(true)
- })
-
- it('returns only named immutable fixtures', () => {
- const fixture = getTasksTileFixture('active-all')
- expect(fixture).toBe(TASKS_TILE_FIXTURES['active-all'])
- expect(Object.isFrozen(fixture)).toBe(true)
- expect(Object.isFrozen(fixture?.source.tasks)).toBe(true)
- expect(getTasksTileFixture('unknown')).toBeNull()
- expect(getTasksTileFixture(null)).toBeNull()
- expect(resolveTasksTileFixture('active-all', false)).toBeNull()
- expect(resolveTasksTileFixture('active-all', true)).toBe(fixture)
- })
-})
diff --git a/src/renderer/routes/downloads/status-pill.test.tsx b/src/renderer/routes/downloads/status-pill.test.tsx
deleted file mode 100644
index d914004d..00000000
--- a/src/renderer/routes/downloads/status-pill.test.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import '@testing-library/jest-dom/vitest'
-import '@renderer/lib/i18n'
-import { TaskStatus } from '@shared/types/task'
-import { render, screen } from '@testing-library/react'
-import { describe, expect, it } from 'vitest'
-import { StatusPill } from './status-pill'
-
-describe('StatusPill', () => {
- it('renders localized label for each status', () => {
- render(<StatusPill status={TaskStatus.Downloading} />)
- expect(screen.getByText(/downloading/i)).toBeInTheDocument()
- })
-
- it('renders FetchingMetadata as Fetching', () => {
- render(<StatusPill status={TaskStatus.FetchingMetadata} />)
- expect(screen.getByText('Fetching')).toBeInTheDocument()
- expect(screen.queryByText('Fetching metadata')).not.toBeInTheDocument()
- })
-})
diff --git a/src/renderer/routes/downloads/status-title-menu.test.tsx b/src/renderer/routes/downloads/status-title-menu.test.tsx
index 522bfff6..f7f69712 100644
--- a/src/renderer/routes/downloads/status-title-menu.test.tsx
+++ b/src/renderer/routes/downloads/status-title-menu.test.tsx
@@ -78,13 +78,4 @@ describe('StatusTitleMenu', () => {
)
expect(onTabChange).toHaveBeenCalledWith('completed')
})
-
- it('positions the trigger for window-chrome stacking', () => {
- render(<StatusTitleMenu tab="all" onTabChange={vi.fn()} counts={counts} />)
- const trigger = screen.getByRole('button', { name: /downloads/i })
- // `relative` gives the trigger its own stacking context so it can be
- // z-layered against the fixed WindowChrome drag strip (the exact z is
- // tuned in the component). The app-region itself isn't observable in jsdom.
- expect(trigger).toHaveClass('relative')
- })
})
diff --git a/src/renderer/routes/downloads/task-row.test.tsx b/src/renderer/routes/downloads/task-row.test.tsx
index 9a087260..ddaac99b 100644
--- a/src/renderer/routes/downloads/task-row.test.tsx
+++ b/src/renderer/routes/downloads/task-row.test.tsx
@@ -261,12 +261,6 @@ describe('TaskRow', () => {
expect(container.firstChild).toHaveAttribute('aria-selected', 'true')
})
- it('uses the same minimum width as the scrollable column header', () => {
- const { container } = render(<TaskRow task={fake()} rowProps={rowProps} />)
-
- expect(container.firstChild).toHaveStyle({ minWidth: '1382px' })
- })
-
it('renders localized creation and completion timestamps and refreshes on completion', () => {
const createdAt = Date.parse('2020-09-13T01:02:08Z')
const finishedAt = Date.parse('2020-09-13T03:04:19Z')
diff --git a/src/renderer/routes/plugins/components/about-section.test.tsx b/src/renderer/routes/plugins/components/about-section.test.tsx
deleted file mode 100644
index e5f2a26a..00000000
--- a/src/renderer/routes/plugins/components/about-section.test.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-import '@testing-library/jest-dom/vitest'
-import '@renderer/lib/i18n'
-import { render, screen } from '@testing-library/react'
-import { describe, expect, it } from 'vitest'
-import { AboutSection } from './about-section'
-
-describe('AboutSection', () => {
- it('renders description without repeating plugin identity', () => {
- render(
- <AboutSection
- manifest={
- {
- id: 'media.video-helper',
- name: 'Video Helper',
- version: '1.2.3',
- description: 'Reads supported video sites.',
- } as never
- }
- />
- )
- expect(screen.queryByText('Video Helper')).toBeNull()
- expect(screen.queryByText('v1.2.3 · media.video-helper')).toBeNull()
- expect(screen.getByText('Reads supported video sites.')).toBeInTheDocument()
- })
-
- it('renders author when present', () => {
- render(
- <AboutSection
- manifest={
- {
- id: 'x',
- name: 'X',
- version: '1',
- description: '',
- author: 'Alice',
- } as never
- }
- />
- )
- expect(screen.getByText(/Alice/)).toBeInTheDocument()
- })
-
- it('renders homepage as external link', () => {
- render(
- <AboutSection
- manifest={
- {
- id: 'x',
- name: 'X',
- version: '1',
- description: '',
- homepage: 'https://example.com',
- } as never
- }
- />
- )
- const link = screen.getByRole('link', { name: 'https://example.com' })
- expect(link).toHaveAttribute('target', '_blank')
- expect(link).toHaveAttribute('rel', 'noreferrer')
- })
-})
diff --git a/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-edge.test.tsx b/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-edge.test.tsx
index e9756f3b..bd83fd8e 100644
--- a/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-edge.test.tsx
+++ b/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-edge.test.tsx
@@ -183,18 +183,6 @@ describe('PluginCallGraphEdge', () => {
)
})
- it('uses Task 6 bounded width and exposes selected styling', () => {
- const { getByTestId } = render(
- <PluginCallGraphEdge {...edgeProps({ selected: true })} />
- )
- const path = getByTestId('edge-path')
-
- expect(path).toHaveStyle({ strokeWidth: '5.5' })
- expect(path).toHaveAttribute('data-selected', 'true')
- expect(path).toHaveClass('stroke-primary')
- expect(path).not.toHaveClass('animated')
- })
-
it('hides non-selected labels in reduced and table-first density', () => {
const { queryByTestId, rerender } = render(
<PluginCallGraphEdge
diff --git a/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-legend.test.tsx b/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-legend.test.tsx
deleted file mode 100644
index a063bc2b..00000000
--- a/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-legend.test.tsx
+++ /dev/null
@@ -1,28 +0,0 @@
-import '@testing-library/jest-dom/vitest'
-import { render, screen, within } from '@testing-library/react'
-import { describe, expect, it } from 'vitest'
-import { PluginCallGraphLegend } from './plugin-call-graph-legend'
-
-describe('PluginCallGraphLegend', () => {
- it('exposes both ends of the visual call-volume scale', () => {
- render(
- <PluginCallGraphLegend
- strings={{
- label: 'Call volume legend',
- fewerCalls: 'Fewer calls',
- moreCalls: 'More calls',
- }}
- />
- )
- const legend = screen.getByRole('group', { name: 'Call volume legend' })
- expect(within(legend).getByText('Fewer calls')).toBeVisible()
- expect(within(legend).getByText('More calls')).toBeVisible()
- expect(within(legend).getByTestId('call-volume-thin')).toHaveClass(
- 'h-[2px]'
- )
- expect(within(legend).getByTestId('call-volume-thick')).toHaveClass(
- 'h-[6px]'
- )
- expect(legend).toHaveClass('pointer-events-none')
- })
-})
diff --git a/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-table.test.tsx b/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-table.test.tsx
index 0458e60e..4134d489 100644
--- a/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-table.test.tsx
+++ b/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-table.test.tsx
@@ -134,25 +134,4 @@ describe('PluginCallGraphTable', () => {
expect(screen.queryByRole('complementary')).not.toBeInTheDocument()
expect(screen.queryByRole('button')).not.toBeInTheDocument()
})
-
- it('owns the single labeled mode scroller with a sticky header', () => {
- const { container } = render(
- <PluginCallGraphTable rows={model.tableRows} strings={strings} />
- )
-
- const region = screen.getByRole('region', {
- name: strings.tableRegionLabel,
- })
- expect(region).toHaveClass('min-h-0', 'flex-1')
- expect(
- container.querySelectorAll('[data-slot="scroll-area-viewport"]')
- ).toHaveLength(1)
- expect(region.querySelector('thead')).toHaveClass(
- 'sticky',
- 'top-0',
- 'z-10',
- 'bg-background'
- )
- expect(region.className).not.toContain('360')
- })
})
diff --git a/src/renderer/routes/plugins/components/plugin-audience-badge.test.tsx b/src/renderer/routes/plugins/components/plugin-audience-badge.test.tsx
deleted file mode 100644
index b556ab55..00000000
--- a/src/renderer/routes/plugins/components/plugin-audience-badge.test.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import '@testing-library/jest-dom/vitest'
-import '@renderer/lib/i18n'
-import { render, screen } from '@testing-library/react'
-import { describe, expect, it } from 'vitest'
-import { PluginAudienceBadge } from './plugin-audience-badge'
-
-describe('PluginAudienceBadge', () => {
- it('renders "Looks safe" for safe tone', () => {
- render(<PluginAudienceBadge tone="safe" />)
- expect(screen.getByText('Looks safe')).toBeInTheDocument()
- })
-})
diff --git a/src/renderer/routes/plugins/components/plugin-avatar.test.tsx b/src/renderer/routes/plugins/components/plugin-avatar.test.tsx
deleted file mode 100644
index de28d04f..00000000
--- a/src/renderer/routes/plugins/components/plugin-avatar.test.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-import '@testing-library/jest-dom/vitest'
-import { render } from '@testing-library/react'
-import { describe, expect, it } from 'vitest'
-import { PluginAvatar } from './plugin-avatar'
-
-describe('PluginAvatar', () => {
- it('renders initials fallback', () => {
- const { getByText } = render(
- <PluginAvatar
- plugin={{ id: 'test.demo-config', name: 'Demo Config Plugin' } as never}
- />
- )
- expect(getByText('DC')).toBeInTheDocument()
- })
-
- it('applies deterministic background tone class', () => {
- const { container, rerender } = render(
- <PluginAvatar plugin={{ id: 'stable.id', name: 'X' } as never} />
- )
- const fallback1 = container.querySelector('[data-slot="avatar-fallback"]')
- expect(fallback1).not.toBeNull()
- const first = fallback1!.className
- rerender(<PluginAvatar plugin={{ id: 'stable.id', name: 'X' } as never} />)
- const fallback2 = container.querySelector('[data-slot="avatar-fallback"]')
- const second = fallback2!.className
- expect(first).toBe(second)
- expect(first).toMatch(/bg-(blue|green|purple|pink|teal|indigo)-100/)
- })
-
- it('honors size prop', () => {
- const { container } = render(
- <PluginAvatar plugin={{ id: 'x', name: 'X' } as never} size={54} />
- )
- const avatar = container.querySelector('[data-slot="avatar"]')
- expect(avatar).toHaveStyle({ width: '54px', height: '54px' })
- })
-})
diff --git a/src/renderer/routes/settings/cards/about-dialog.test.tsx b/src/renderer/routes/settings/cards/about-dialog.test.tsx
index 28296bf8..530c1385 100644
--- a/src/renderer/routes/settings/cards/about-dialog.test.tsx
+++ b/src/renderer/routes/settings/cards/about-dialog.test.tsx
@@ -671,20 +671,6 @@ describe('<AboutDialog>', () => {
)
})
- it('keeps the update form inside a shrinkable scroll region', () => {
- renderDialog()
-
- expect(screen.getByRole('dialog')).toHaveClass(
- 'flex',
- 'max-h-[calc(100svh-2rem)]',
- 'overflow-hidden'
- )
- expect(screen.getByTestId('about-dialog-scroll')).toHaveAttribute(
- 'data-slot',
- 'scroll-area-viewport'
- )
- })
-
it('renders the web note without querying or subscribing to app updates', () => {
const showUpdates = vi
.spyOn(appUpdateSection, 'shouldShowAppUpdate')
diff --git a/src/server/plugin/hook-runtime-assembly.test.ts b/src/server/plugin/hook-runtime-assembly.test.ts
deleted file mode 100644
index 7cf261ac..00000000
--- a/src/server/plugin/hook-runtime-assembly.test.ts
+++ /dev/null
@@ -1,64 +0,0 @@
-import { readFileSync } from 'node:fs'
-import path from 'node:path'
-import { describe, expect, it } from 'vitest'
-
-function serverSource(): string {
- return readFileSync(
- path.resolve(process.cwd(), 'src/server/index.ts'),
- 'utf8'
- )
-}
-
-describe('Server plugin Hook runtime assembly', () => {
- it('injects every Hook service from one shared runtime instance', () => {
- const source = serverSource()
- expect(source).toContain(
- 'const pluginRuntime = await createPluginRuntime({'
- )
- expect(source).toContain('pluginHookRuntime = pluginRuntime.hooks')
- expect(source).toContain('const hookAuditLog = pluginRuntime.auditLog')
- expect(source).toContain(
- 'const hookOrchestrator = pluginRuntime.orchestrator'
- )
- expect(source).toContain(
- 'const finalizeFilesystemAdapter = pluginRuntime.finalizeFilesystem'
- )
- expect(source).toContain(
- 'const durableFinalizeRuntime = pluginRuntime.finalize'
- )
- })
-
- it('recovers and drains before opening producers', () => {
- const source = serverSource()
- const recover = source.indexOf('await pluginStartup.recoverFinalize(')
- const tasks = source.indexOf('pluginStartup.markTasksRecovered()')
- const drain = source.indexOf('await pluginStartup.drainBeforeProducers({')
- const scheduler = source.indexOf(
- 'postDeliveryLoop = pluginHookRuntime.scheduler'
- )
- const producers = source.indexOf('pluginStartup.openProducers(() => {')
-
- expect(recover).toBeGreaterThan(-1)
- expect(recover).toBeLessThan(tasks)
- expect(tasks).toBeLessThan(drain)
- expect(drain).toBeLessThan(scheduler)
- expect(scheduler).toBeLessThan(producers)
- })
-
- it('aborts and drains post delivery before shutting down the Host', () => {
- const source = serverSource()
- const shutdown = source.slice(
- source.indexOf('shutdownActions.drainPluginHost = async () => {'),
- source.indexOf(
- 'shutdownActions.disposeFinalizeFs = () => finalizeFilesystemAdapter.dispose()'
- )
- )
- const abort = shutdown.indexOf('postDeliveryAbortController.abort()')
- const drain = shutdown.indexOf('await postDeliveryLoop')
- const host = shutdown.indexOf('await pluginHost.shutdown()')
-
- expect(abort).toBeGreaterThan(-1)
- expect(abort).toBeLessThan(drain)
- expect(drain).toBeLessThan(host)
- })
-})
diff --git a/src/shared/errors.test.ts b/src/shared/errors.test.ts
deleted file mode 100644
index 21adbd17..00000000
--- a/src/shared/errors.test.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { describe, expect, it } from 'vitest'
-import { ErrorCode } from './errors'
-
-describe('ErrorCode NAT entries', () => {
- it('contains all NAT error codes', () => {
- expect(ErrorCode.NatDiscoveryFailed).toBe('NAT_DISCOVERY_FAILED')
- expect(ErrorCode.NatMappingFailed).toBe('NAT_MAPPING_FAILED')
- expect(ErrorCode.NatMappingConflict).toBe('NAT_MAPPING_CONFLICT')
- expect(ErrorCode.NatProtocolRejected).toBe('NAT_PROTOCOL_REJECTED')
- expect(ErrorCode.NatParseError).toBe('NAT_PARSE_ERROR')
- expect(ErrorCode.NatSecurityViolation).toBe('NAT_SECURITY_VIOLATION')
- expect(ErrorCode.NatTimeout).toBe('NAT_TIMEOUT')
- expect(ErrorCode.NatNetworkChanged).toBe('NAT_NETWORK_CHANGED')
- expect(ErrorCode.NatGatewayUnreachable).toBe('NAT_GATEWAY_UNREACHABLE')
- expect(ErrorCode.StunDetectionFailed).toBe('STUN_DETECTION_FAILED')
- expect(ErrorCode.IpcInvalidPayload).toBe('IPC_INVALID_PAYLOAD')
- expect(ErrorCode.IpcRateLimited).toBe('IPC_RATE_LIMITED')
- })
-})
diff --git a/src/shared/platform/aria2.test.ts b/src/shared/platform/aria2.test.ts
deleted file mode 100644
index f77cbf36..00000000
--- a/src/shared/platform/aria2.test.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { describe, expect, it } from 'vitest'
-import { aria2BinaryName } from './aria2'
-
-describe('aria2BinaryName', () => {
- it('returns aria2c.exe on win32', () => {
- expect(aria2BinaryName('win32')).toBe('aria2c.exe')
- })
- it('returns aria2c on darwin', () => {
- expect(aria2BinaryName('darwin')).toBe('aria2c')
- })
- it('returns aria2c on linux', () => {
- expect(aria2BinaryName('linux')).toBe('aria2c')
- })
-})
diff --git a/tests/check-third-party-notices.test.ts b/tests/check-third-party-notices.test.ts
index a68d92ad..36c175dc 100644
--- a/tests/check-third-party-notices.test.ts
+++ b/tests/check-third-party-notices.test.ts
@@ -740,7 +740,6 @@ describe('third-party graph dependency notices', () => {
})
it.each([
- ['CI', '.github/workflows/ci.yml'],
['release', '.github/workflows/release.yml'],
['Flatpak', '.github/workflows/flatpak.yml'],
])(
diff --git a/tests/scripts/docker-server-docs.test.ts b/tests/scripts/docker-server-docs.test.ts
deleted file mode 100644
index 67bb44e9..00000000
--- a/tests/scripts/docker-server-docs.test.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-import { readFile } from 'node:fs/promises'
-import path from 'node:path'
-import { describe, expect, it } from 'vitest'
-
-const ROOT = process.cwd()
-
-async function text(file: string) {
- return readFile(path.join(ROOT, file), 'utf8')
-}
-
-describe('public Docker Server documentation', () => {
- it.each(['docs/docker-server.md', 'docs/docker-server.zh-CN.md'])(
- '%s covers the public NAS installation and lifecycle contract',
- async (file) => {
- const document = await text(file)
-
- for (const required of [
- 'docker.io/motrixapp/motrix-server',
- 'ghcr.io/agalwood/motrix-server',
- 'linux/amd64',
- 'linux/arm64',
- 'stable',
- 'latest',
- 'compose.yaml',
- 'compose.named-volumes.yaml',
- 'compose.reverse-proxy.env',
- '/data',
- '/downloads',
- 'MOTRIX_UID',
- 'MOTRIX_GID',
- 'operator-token',
- 'motrix-admin pairing approve ABCD-EFGH',
- 'MOTRIX_PUBLIC_URL',
- 'MOTRIX_REMOTE_EXTENSION_ENABLED',
- 'MOTRIX_REMOTE_EXTENSION_PUBLIC_URL',
- 'MOTRIX_ALLOW_INSECURE_OPERATOR_HTTP',
- 'MOTRIX_WEB_BIND_IP',
- 'MOTRIX_MDXP_BIND_IP',
- 'MOTRIX_BIND_IP',
- 'MOTRIX_ARIA2_RPC_LISTEN_ALL',
- '.motrix-server-bridge-owner.json',
- 'binding-insecure-mode',
- 'docker compose down',
- '16800',
- '/mdxp/events',
- '/healthz',
- '/api/diagnostics',
- 'DSM 7',
- 'fnOS',
- 'read-only',
- 'HTTPS',
- 'digest',
- ]) {
- expect(document, `${file} must mention ${required}`).toContain(required)
- }
- expect(document).not.toContain('docker compose up --build')
- }
- )
-
- it.each(['README.md', 'README.zh-CN.md'])(
- '%s uses the registry-first quick start',
- async (file) => {
- const document = await text(file)
- expect(document).toContain('docker compose pull server')
- expect(document).toContain('docker compose up -d --wait')
- expect(document).toContain('motrix-admin pairing approve ABCD-EFGH')
- expect(document).not.toContain('docker compose up --build')
- }
- )
-})
diff --git a/tests/scripts/flatpak-packaging.test.ts b/tests/scripts/flatpak-packaging.test.ts
deleted file mode 100644
index 1c6d7d1d..00000000
--- a/tests/scripts/flatpak-packaging.test.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { describe, expect, it } from 'vitest'
-// @ts-expect-error -- JavaScript packaging script intentionally has no declarations
-import { verifyFlatpakPackaging } from '../../scripts/verify-flatpak-packaging.mjs'
-
-describe('Flatpak packaging contract', () => {
- it('keeps source, architecture, offline, and runtime paths aligned', async () => {
- await expect(verifyFlatpakPackaging(process.cwd())).resolves.toMatchObject({
- modules: 4,
- builtinSources: 6,
- brokerCommand: 'motrix-native-host-broker',
- electronPackageVerification: true,
- privateProtocolVersion: 1,
- })
- })
-})
diff --git a/tests/scripts/release-version-contract.test.ts b/tests/scripts/release-version-contract.test.ts
deleted file mode 100644
index d6cee34a..00000000
--- a/tests/scripts/release-version-contract.test.ts
+++ /dev/null
@@ -1,102 +0,0 @@
-import { readFileSync } from 'node:fs'
-import path from 'node:path'
-import { describe, expect, it } from 'vitest'
-// @ts-expect-error -- JavaScript release script intentionally has no declarations
-import { resolveReleaseMetadata } from '../../scripts/release-metadata.mjs'
-
-const ROOT = path.resolve(import.meta.dirname, '../..')
-
-function read(relativePath: string): string {
- return readFileSync(path.join(ROOT, relativePath), 'utf8')
-}
-
-const packageVersion = (JSON.parse(read('package.json')) as { version: string })
- .version
-const releaseTag = `v${packageVersion}`
-describe('release version contract', () => {
- it('keeps package and Flatpak release metadata aligned', () => {
- expect(
- resolveReleaseMetadata({
- eventName: 'workflow_dispatch',
- refName: 'main',
- refProtected: 'false',
- packageVersion,
- }).version
- ).toBe(packageVersion)
-
- const metainfo = read('flatpak/app.motrix.native.metainfo.xml')
- const latestRelease =
- /<release version="([^"]+)" date="(\d{4}-\d{2}-\d{2})">/.exec(metainfo)
- expect(latestRelease?.[1]).toBe(packageVersion)
- expect(latestRelease?.[2]).toMatch(/^\d{4}-\d{2}-\d{2}$/)
- })
-
- it('advertises only the current release in both READMEs', () => {
- for (const [readmePath, notesPath] of [
- ['README.md', `docs/release-notes/${packageVersion}.md`],
- ['README.zh-CN.md', `docs/release-notes/${packageVersion}.zh-CN.md`],
- ] as const) {
- const source = read(readmePath)
- expect(source).toContain(
- `https://github.com/agalwood/Motrix/releases/tag/${releaseTag}`
- )
- expect(source).toContain(`./${notesPath}`)
- expect(source).toContain(
- `docker.io/motrixapp/motrix-server:${packageVersion}`
- )
- const advertisedReleaseTags = Array.from(
- source.matchAll(
- /https:\/\/github\.com\/agalwood\/Motrix\/releases\/tag\/([^\s)]+)/g
- ),
- (match) => match[1]
- )
- expect(new Set(advertisedReleaseTags)).toEqual(new Set([releaseTag]))
- }
- })
-
- it('ships paired, tag-pinned notes for the current version', () => {
- const englishPath = `docs/release-notes/${packageVersion}.md`
- const chinesePath = `docs/release-notes/${packageVersion}.zh-CN.md`
- const english = read(englishPath)
- const chinese = read(chinesePath)
-
- expect(english).toContain(`# Motrix ${packageVersion}`)
- expect(chinese).toContain(`# Motrix ${packageVersion}`)
- expect(english).toContain(
- `https://github.com/agalwood/Motrix/blob/${releaseTag}/${chinesePath}`
- )
- expect(chinese).toContain(
- `https://github.com/agalwood/Motrix/blob/${releaseTag}/${englishPath}`
- )
- })
-
- it('preserves current release references', () => {
- const english = read(`docs/release-notes/${packageVersion}.md`)
- const chinese = read(`docs/release-notes/${packageVersion}.zh-CN.md`)
- const releaseMetadata = resolveReleaseMetadata({
- eventName: 'workflow_dispatch',
- refName: 'main',
- refProtected: 'false',
- packageVersion,
- })
-
- expect(english).toContain(
- `https://github.com/agalwood/Motrix/blob/${releaseTag}/docs/docker-server.md`
- )
- expect(chinese).toContain(
- `https://github.com/agalwood/Motrix/blob/${releaseTag}/docs/docker-server.zh-CN.md`
- )
-
- for (const source of [english, chinese]) {
- expect(source).toContain(
- `docker.io/motrixapp/motrix-server:${packageVersion}`
- )
- expect(source).toContain(
- `ghcr.io/agalwood/motrix-server:${packageVersion}`
- )
- if (releaseMetadata.channel === 'beta') {
- expect(source).toContain('latest/edge')
- }
- }
- })
-})
diff --git a/tests/scripts/safari-desktop-package.test.ts b/tests/scripts/safari-desktop-package.test.ts
index 7aed5be5..044c235b 100644
--- a/tests/scripts/safari-desktop-package.test.ts
+++ b/tests/scripts/safari-desktop-package.test.ts
@@ -133,19 +133,6 @@ describe('Safari desktop distribution', () => {
}
})
- it('gives unsigned and signed release builds the same per-attempt bundle version', () => {
- const workflow = readFileSync('.github/workflows/release.yml', 'utf8')
- const versions = workflow.match(/-c\.mac\.bundleVersion=[^\r\n ]+/g)
- // Match complete expressions because GitHub expressions contain spaces.
- expect(versions).toHaveLength(2)
- expect(
- workflow.split(
- // biome-ignore lint/suspicious/noTemplateCurlyInString: literal GitHub Actions expression
- '-c.mac.bundleVersion=${{ github.run_number }}.${{ github.run_attempt }}.0'
- )
- ).toHaveLength(3)
- })
-
it('embeds desktop helpers in both unsigned and isolated signing packages', () => {
for (const name of [
'electron-builder.json',
diff --git a/tests/scripts/server-runtime-workflow.test.ts b/tests/scripts/server-runtime-workflow.test.ts
deleted file mode 100644
index 35be167d..00000000
--- a/tests/scripts/server-runtime-workflow.test.ts
+++ /dev/null
@@ -1,109 +0,0 @@
-import { readFileSync } from 'node:fs'
-import { createRequire } from 'node:module'
-import path from 'node:path'
-import { describe, expect, it } from 'vitest'
-
-const ROOT = process.cwd()
-const require = createRequire(import.meta.url)
-const parseYaml = require('js-yaml').load as (source: string) => unknown
-const MATRIX_ARCH_EXPRESSION = '--platform linux/${' + '{ matrix.docker_arch }}'
-const MATRIX_TARGET_EXPRESSION = '${' + '{ matrix.target }}'
-
-interface Step {
- name?: string
- run?: string
- uses?: string
- with?: Record<string, unknown>
-}
-
-interface ServerRuntimeJob {
- name?: string
- 'runs-on'?: string
- strategy?: {
- matrix?: {
- include?: Array<Record<string, string>>
- }
- }
- steps?: Step[]
-}
-
-describe('Server runtime CI pipeline', () => {
- const source = readFileSync(
- path.join(ROOT, '.github/workflows/ci.yml'),
- 'utf8'
- )
- const workflow = parseYaml(source) as {
- jobs?: Record<string, ServerRuntimeJob>
- }
- const job = workflow.jobs?.['server-runtime']
- const steps = job?.steps ?? []
-
- it('runs native x64 and arm64 Node 24 Docker jobs', () => {
- expect(job).toBeDefined()
- expect(job?.strategy?.matrix?.include).toEqual([
- {
- target: 'linux-x64-musl',
- os: 'ubuntu-22.04',
- docker_arch: 'amd64',
- },
- {
- target: 'linux-arm64-musl',
- os: 'ubuntu-22.04-arm',
- docker_arch: 'arm64',
- },
- ])
- expect(
- steps.find((step) => step.uses?.startsWith('actions/setup-node@'))?.with
- ).toEqual({ 'node-version': 24 })
- })
-
- it('orders build, report export, runtime smoke, and artifact upload', () => {
- const names = steps.map((step) => step.name)
- const build = names.indexOf('Build staged Server image')
- const report = names.indexOf('Export Server size report')
- const smoke = names.indexOf('Smoke staged Server image')
- const upload = names.indexOf('Upload Server size report')
- expect(build).toBeGreaterThanOrEqual(0)
- expect(report).toBeGreaterThan(build)
- expect(smoke).toBeGreaterThan(report)
- expect(upload).toBeGreaterThan(smoke)
-
- expect(steps[build]?.run).toContain(MATRIX_ARCH_EXPRESSION)
- expect(steps[report]?.run).toContain('--target server-size-report')
- expect(steps[report]?.run).toContain(
- '--output type=local,dest=release/size-reports'
- )
- expect(steps[smoke]?.run).toContain('scripts/smoke-server-image.mjs')
- expect(steps[upload]?.with).toEqual(
- expect.objectContaining({
- name: `server-size-report-${MATRIX_TARGET_EXPRESSION}`,
- path: `release/size-reports/server-${MATRIX_TARGET_EXPRESSION}.json`,
- 'if-no-files-found': 'error',
- })
- )
- })
-
- it('keeps package scripts and Docker regression assertions in CI', () => {
- const manifest = JSON.parse(
- readFileSync(path.join(ROOT, 'package.json'), 'utf8')
- ) as { scripts?: Record<string, string> }
- expect(manifest.scripts).toEqual(
- expect.objectContaining({
- 'stage:server': 'node scripts/stage-server-app.mjs',
- 'verify:server-package': 'node scripts/verify-server-package.mjs',
- 'smoke:server-package': 'node scripts/smoke-server-package.mjs',
- 'smoke:server-image': 'node scripts/smoke-server-image.mjs',
- })
- )
- const ciSteps = workflow.jobs?.ci?.steps ?? []
- const releaseContract = ciSteps.find(
- (step) => step.name === 'Release and packaging contracts'
- )
- expect(releaseContract?.run).toContain(
- 'tests/scripts/docker-server-runtime.test.ts'
- )
- expect(releaseContract?.run).toContain(
- 'tests/scripts/verify-server-package.test.ts'
- )
- })
-})
diff --git a/tests/scripts/workflow-release-matrix.test.ts b/tests/scripts/workflow-release-matrix.test.ts
index c788b97a..a0daf60d 100644
--- a/tests/scripts/workflow-release-matrix.test.ts
+++ b/tests/scripts/workflow-release-matrix.test.ts
@@ -244,10 +244,6 @@ const cargoConfigSource = readFileSync(
path.join(ROOT, '.cargo/config.toml'),
'utf8'
)
-const nativeHostCargoManifestSource = readFileSync(
- path.join(ROOT, 'packages/native-host/Cargo.toml'),
- 'utf8'
-)
const windowsDependencyVerifierSource = readFileSync(
path.join(ROOT, 'scripts/verify-windows-native-host-dependencies.ps1'),
'utf8'
@@ -541,130 +537,6 @@ describe('CI and release target matrix contract', () => {
})
})
-describe('general CI native-host split contract', () => {
- it('blocks on the shared allowlist and JavaScript packaging tests', () => {
- const jobs = workflowJobs(ciWorkflow)
- const ciJob = asRecord(jobs.ci, 'CI job')
- const steps = jobSteps(ciJob)
- const lint = steps.find((step) => step.name === 'Lint')
- const tooling = steps.find(
- (step) => step.name === 'Native host JavaScript tooling tests'
- )
- const contracts = steps.find(
- (step) => step.name === 'Release and packaging contracts'
- )
-
- // Lint runs through the package script so the workflow, the local
- // commit gate, and biome.json cannot drift apart. The repo-wide
- // `biome check .` keeps the native-host tooling scripts covered —
- // the guarantee the previous explicit path list existed for.
- expect(lint).toBeDefined()
- const lintCommand = stringField(lint as LooseRecord, 'run')
- expect(lintCommand.trim()).toBe('pnpm run lint')
- const packageJson = JSON.parse(
- readFileSync(path.join(ROOT, 'package.json'), 'utf8')
- ) as { scripts?: Record<string, string> }
- expect(packageJson.scripts?.lint).toBe('biome check .')
-
- const fingerprint = steps.find(
- (step) => step.name === 'Biome toolchain fingerprint'
- )
- expect(fingerprint).toBeDefined()
- expect(stringField(fingerprint as LooseRecord, 'run')).toContain(
- 'biome --version'
- )
-
- expect(tooling).toBeDefined()
- const toolingCommand = stringField(tooling as LooseRecord, 'run')
- expect(toolingCommand).toContain('packages/native-host/build.test.mjs')
- expect(toolingCommand).toContain(
- 'packages/native-host/package-flatpak-companion.test.mjs'
- )
-
- expect(contracts).toBeDefined()
- const contractCommand = stringField(contracts as LooseRecord, 'run')
- expect(contractCommand).toContain(
- 'src/main/bridge/native-messaging-extensions.test.ts'
- )
- expect(contractCommand).toContain(
- 'tests/scripts/flatpak-native-host.test.ts'
- )
- for (const test of [
- 'tests/scripts/appimage-artifact.test.ts',
- 'tests/scripts/electron-package-contract.test.ts',
- 'tests/scripts/finalize-appimage-artifact.test.ts',
- 'tests/scripts/native-binary-target.test.ts',
- 'tests/scripts/release-signing-input.test.ts',
- 'tests/scripts/stage-electron-app.test.ts',
- 'tests/scripts/verify-electron-package.test.ts',
- 'tests/scripts/verify-appimage-artifact.test.ts',
- ]) {
- expect(contractCommand).toContain(test)
- }
- })
-
- it('compiles every declared native-host binary on host and target runners', () => {
- for (const binary of [
- 'motrix-native-host',
- 'motrix-flatpak-native-host',
- 'motrix-native-host-broker',
- ]) {
- expect(nativeHostCargoManifestSource).toContain(`name = "${binary}"`)
- }
-
- const jobs = workflowJobs(ciWorkflow)
- const rustQuality = asRecord(jobs['rust-quality'], 'rust-quality job')
- const rustTests = jobSteps(rustQuality).find(
- (step) => step.name === 'Tests'
- )
- expect(stringField(rustTests as LooseRecord, 'run')).toContain(
- '--all-targets'
- )
-
- const targetTests = jobSteps(targetMatrix(ciWorkflow).job).find(
- (step) => step.name === 'Tests (native target)'
- )
- expect(stringField(targetTests as LooseRecord, 'run')).toContain(
- '--all-targets'
- )
- })
-
- it('smoke-packages companions only on Linux', () => {
- const smoke = jobSteps(targetMatrix(ciWorkflow).job).find(
- (step) => step.name === 'Package Flatpak native host companion smoke'
- )
-
- expect(smoke).toBeDefined()
- expect(stringField(smoke as LooseRecord, 'if')).toContain(
- "matrix.platform == 'linux'"
- )
- const command = stringField(smoke as LooseRecord, 'run')
- expect(command).toContain('package:flatpak-native-host')
- expect(command).toContain('--arch "$COMPANION_ARCH"')
- expect(command).toContain('--output-dir "$COMPANION_OUTPUT"')
- expect(command).toContain('tar -tzf "$archive"')
- })
-
- it('keeps Flatpak-only binaries out of every ordinary Electron package', () => {
- const steps = jobSteps(targetMatrix(ciWorkflow).job)
- const packagingIndex = steps.findIndex((step) =>
- stringField(step, 'run', '').includes('electron-builder')
- )
- const verificationIndex = steps.findIndex(
- (step) => step.name === 'Verify packaged resources'
- )
- expect(packagingIndex).toBeGreaterThanOrEqual(0)
- expect(verificationIndex).toBeGreaterThan(packagingIndex)
-
- const command = stringField(steps[verificationIndex] as LooseRecord, 'run')
- expect(command).toContain("path.join('bin', host)")
- expect(command).toMatch(/path\.join\(\s*'extra'/)
- expect(command).toContain('motrix-flatpak-native-host')
- expect(command).toContain('motrix-native-host-broker')
- expect(command).toContain('Flatpak-only native host leaked into package')
- })
-})
-
describe('release workflow publication contract', () => {
it('derives the GitHub Release body from validated version metadata', () => {
const jobs = workflowJobs(releaseWorkflow)
diff --git a/tests/scripts/workflow-snap.test.ts b/tests/scripts/workflow-snap.test.ts
index 0f66cf7e..fc933a90 100644
--- a/tests/scripts/workflow-snap.test.ts
+++ b/tests/scripts/workflow-snap.test.ts
@@ -28,10 +28,6 @@ const promotionSource = readFileSync(
path.join(ROOT, '.github/workflows/snap-promote.yml'),
'utf8'
)
-const ciSource = readFileSync(
- path.join(ROOT, '.github/workflows/ci.yml'),
- 'utf8'
-)
const snapWorkflow = asRecord(parseYaml(snapSource), 'Snap workflow')
const promotionWorkflow = asRecord(
parseYaml(promotionSource),
@@ -153,19 +149,6 @@ describe('Snap build workflow contract', () => {
expect(snapSource).not.toContain('pull_request_target')
})
- it('gates the Snap packaging and runtime contracts in general CI', () => {
- for (const test of [
- 'src/main/bridge/snap-environment.test.ts',
- 'tests/scripts/snap-artifact.test.ts',
- 'tests/scripts/snap-build-set-release.test.ts',
- 'tests/scripts/snap-project.test.ts',
- 'tests/scripts/snap-store-channel.test.ts',
- 'tests/scripts/workflow-snap.test.ts',
- ]) {
- expect(ciSource).toContain(test)
- }
- })
-
it('publishes protected tags and explicit protected-main recovery runs through the edge environment', () => {
const preflight = workflowJob(snapWorkflow, 'preflight')
const preflightOutputs = asRecord(preflight.outputs, 'preflight outputs')
diff --git a/vitest.config.ts b/vitest.config.ts
index 89d8d881..3695948b 100644
--- a/vitest.config.ts
+++ b/vitest.config.ts
@@ -14,12 +14,27 @@ export default defineConfig({
}),
},
test: {
- environment: 'jsdom',
+ environment: 'node',
globals: true,
setupFiles: [],
- globalSetup: ['tests/setup/build-worker.ts'],
- include: ['src/**/*.test.{ts,tsx}', 'tests/**/*.test.{ts,tsx}'],
exclude: ['e2e/**', 'node_modules/**', 'dist/**', 'dist-test/**'],
+ projects: [
+ {
+ test: {
+ name: 'node',
+ globalSetup: ['tests/setup/build-worker.ts'],
+ include: ['src/**/*.test.{ts,tsx}', 'tests/**/*.test.{ts,tsx}'],
+ exclude: ['src/{renderer,preload}/**'],
+ },
+ },
+ {
+ test: {
+ name: 'browser',
+ environment: 'jsdom',
+ include: ['src/{renderer,preload}/**/*.test.{ts,tsx}'],
+ },
+ },
+ ],
},
resolve: {
alias: {