Skip to content

Add unit tests for resolveTargets (the app-filter) in toolLayer.ts #27

Description

@vincentvella

Problem. resolveTargets (src/toolLayer.ts:187) powers the app filter across get_logs, get_logs_around, diagnose, get_network, export_har, export_bundle, etc. Its matching logic — exact-id first, substring/label fallback, case-insensitivity, throw-on-no-match — is non-trivial but is only exercised indirectly through the full cockpit selftest (a ~30s offscreen-Electron spin-up).

Proposed. Extract/expose resolveTargets enough to unit-test it and add test/toolLayer.test.ts (bun test) covering: exact match wins over substring, substring + case-insensitive fallback, no-match behavior, and undefined app → undefined. Fast regression coverage without the Electron suite.

Affected: src/toolLayer.ts:187, new test/toolLayer.test.ts.

Filed from the weekly repo audit.

Metadata

Metadata

Assignees

Labels

testTest coverage

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions