Skip to content

[Issue]: Add Pester tests for Invoke-VerifiedDownload orchestration function #264

@WilliamBerryiii

Description

@WilliamBerryiii

Issue Description

The Invoke-VerifiedDownload function in scripts/lib/Get-VerifiedDownload.ps1 has 0% test coverage. This 40-line function orchestrates file downloads with SHA256 verification but is completely untested.

Current state:

  • File coverage: 29% line (22/76)
  • Pure helper functions are well-tested (7 Describe blocks)
  • Main orchestration function Invoke-VerifiedDownload has no tests

Acceptance criteria:

  • Add Describe block for Invoke-VerifiedDownload in Get-VerifiedDownload.Tests.ps1
  • Mock Invoke-WebRequest, Expand-Archive, and file system operations
  • Test success path with valid hash
  • Test failure path with hash mismatch
  • Test skip path when valid file already exists
  • Achieve ≥80% line coverage for the file

Estimated coverage improvement: 29% → ~82%

Additional Context

The existing test file pattern uses InModuleScope with mocked cmdlets. Follow the same approach used for Test-ExistingFileValid and Get-DownloadTargetPath tests.

This is part of a broader effort to increase unit test coverage from ~42% to ~85-90%.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttestingTest infrastructure and test files

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions