test: add Vitest + Testing Library unit tests for running-apps feature

Set up Vitest (jsdom environment) and @testing-library/react.

api.test.ts — fetchRunningApps:
  - returns parsed JSON on 2xx
  - returns [] on non-ok HTTP status
  - returns [] on network error (non-throwing contract)

KnobCard.test.tsx — app_volume:
  - datalist is rendered with all supplied runningApps as options
  - no datalist / list attr when runningApps is empty or omitted
  - onChange called with the new value on input change

KnobCard.test.tsx — group_volume:
  - app-picker select rendered with runningApps options
  - no picker when runningApps is empty or omitted
  - Add button disabled until an app is selected
  - Add button enabled after selection
  - clicking Add appends app to targets
  - clicking Add skips duplicates (onChange not called)
  - picker resets to placeholder after a successful Add
This commit is contained in:
Sean Doran committed 2026-02-28 17:32:28 -05:00
1 parent 88216187d4
commit 2a13248446
7 files changed
+1589 -4

No files matched your search

+5
View File
@@ -14,4 +14,9 @@ export default defineConfig({
'/api': 'http://localhost:5173',
},
},
test: {
environment: 'jsdom',
globals: true,
setupFiles: ['./src/test-setup.ts'],
},
})