Skip to content

Add unit tests for VS Code extension providers #104

@IanMayo

Description

@IanMayo

Problem

The VS Code extension providers lack unit test coverage. Currently only stacTreeProvider has tests (8 tests). The remaining 4 providers have no test coverage:

  • layersTreeProvider - Manages track/location/result layer display in sidebar
  • outlineProvider - Provides document outline for plot structure
  • stacFileSystemProvider - Virtual filesystem for STAC catalog browsing
  • toolsTreeProvider - Displays available analysis tools based on selection context

Scope

Create comprehensive unit tests for each provider:

layersTreeProvider

  • setTracks() / setLocations() / setResultLayers() - data management
  • getTreeItem() / getChildren() - tree structure
  • Visibility toggling
  • Layer removal
  • Event firing on data changes

outlineProvider

  • Symbol generation from plot data
  • Hierarchical structure (tracks → positions, locations)
  • Symbol kinds and icons

stacFileSystemProvider

  • stat() - file/directory metadata
  • readDirectory() - catalog/item listing
  • readFile() - JSON content retrieval
  • Error handling for missing paths

toolsTreeProvider

  • Tool filtering based on selection context
  • getTreeItem() / getChildren() - tree structure
  • Tool categorization
  • Empty state handling

Test Strategy

  • Mock VS Code APIs (vscode.TreeItem, vscode.EventEmitter, etc.)
  • Use vitest with existing test infrastructure
  • Follow patterns from stacTreeProvider.test.ts
  • Test data transformations and state management, not VS Code integration

Acceptance Criteria

  • All 4 providers have test files
  • Each provider has >80% code coverage
  • Tests validate data flow and state management
  • Tests don't require VS Code runtime (pure unit tests)

References

  • Existing: tests/unit/stacTreeProvider.test.ts (pattern to follow)
  • Source: src/providers/*.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions