Skip to content

test(auth): cover the WhoAmI reject path once the Vitest unhandled-rejection artifact is resolved #49

Description

@Bugs5382

Summary

src/context/auth.test.tsx currently drives the AuthProvider denied state via a resolved response with no operator, because a rejected-promise mock trips a Vitest 3.2.7 / tinyspy false "unhandled rejection" failure (interaction with mockReset() in beforeEach). The provider's .catch branch (the real CodeUnauthenticated path) is therefore not directly covered.

Fix options

  • Restructure the test to use a fresh vi.fn() per test instead of beforeEach(mockReset).
  • Or revisit after a Vitest upgrade (4.x) where the artifact may be resolved.

Low risk: the .catch branch is a one-line setState identical to the covered no-operator branch, and the real cert-absent flow exercises it live. Deferred from #47 (Slice A).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions