Skip to content

Add snapshot tests for complex advisory structures in audit-utils #353

@coderabbitai

Description

@coderabbitai

Summary

The audit-utils test suite in frontend-pwa/scripts/audit-utils.test.mjs validates advisory response structures using explicit toEqual assertions, but lacks snapshot tests for complex nested advisory payloads. This was identified as out of scope during the refactoring in PR #350 but should be addressed as a follow-up.

Background

During review of PR #350 (#350), the Testing (Compile-Time / UI) check flagged that whilst the suite tests structured JSON audit output, it does not include snapshot assertions for complex nested advisory structures. Snapshot tests would catch unexpected regressions in the shape of advisory data returned by the bulk advisory endpoint fallback.

Acceptance criteria

  • Introduce Vitest snapshot tests (e.g. expect(result).toMatchSnapshot()) for at least one complex advisory payload in frontend-pwa/scripts/audit-utils.test.mjs.
  • Snapshots should cover the normalised advisory structure produced by the bulk advisory fallback path (e.g. the 'falls back to the bulk advisory endpoint' test case).
  • Existing semantic assertions (toEqual, toHaveBeenNthCalledWith, etc.) must be retained alongside the new snapshots.
  • pnpm exec vitest run scripts/audit-utils.test.mjs passes with no failures.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions