Skip to content

[Enhancement] internal/enricher has no tests: Enrich, enrichModel, and refetchMetadata are completely untested #24

@wiebe-vandendriessche

Description

@wiebe-vandendriessche

Problem or motivation

The internal/enricher package has no test files. It implements Enrich, enrichModel, enrichDataset, applyRefetchedMetadata, and refetchMetadata — the core logic for both interactive and file-based AIBOM enrichment. This is a high-complexity, user-facing code path that handles field selection, viper config parsing, HF API refetching, and BOM mutation. Zero test coverage means regressions in enrichment logic are undetectable without manual testing.

Proposed solution

Add internal/enricher/enricher_test.go covering at minimum:

  • Enrich with strategy: "file" using a test viper instance with known field values — verify the correct fields are set on the output BOM
  • Enrich with a nil BOM — verify error is returned
  • Enrich with Refetch: false — verify no API calls are made
  • applyRefetchedMetadata with a valid ModelAPIResponse — verify fields are applied to the BOM
  • enrichModel with RequiredOnly: true — verify only required fields are presented

Use the existing fetcher.DummyModelAPIFetcher and fetcher.DummyModelReadmeFetcher for HF call injection.

Alternatives considered

None — this is a straightforward gap to fill with unit tests.

Additional context

Affected directory: internal/enricher/. The interactive.go and preview.go files in the same package also have no tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttestsWrite tests

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions