fix(test): de-flake authProvider.test.ts OOBE test-connection (GRO-2745) #245
Reference in New Issue
Block a user
Delete Branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
global.fetchviavi.spyOnin the flakyPOST /admin/auth-provider/testtest so it no longer makes real network requests; eliminates the 5s vitest timeout vs 10s route fetch timeout race.afterEach(() => vi.restoreAllMocks())to keep mock state clean between tests.UAT_PLAYBOOK.md — no user-facing behaviour changed; test-hygiene fix only. No playbook section update required.
Fixes: GRO-2745
QA review (GRO-2746) — PASS. dev→uat promotion approved.
Scope & fix
global.fetchviavi.spyOn(...).mockResolvedValueOnce(...)so the OOBE test-connection test no longer makes a real network request — eliminates the 5s vitest timeout vs 10s route fetch-timeout race that flaked CI on PR #243.afterEach(() => vi.restoreAllMocks())added for clean mock teardown between tests.{ ok: true, json: async () => ({...}) }) matches the handler's actual usage (res.okthenres.json()).apps/api/src/__tests__/and the deployedsrc/__tests__/tree.Title/assertion reconciliation — verified correct
authProviderTestSchemainsrc/routes/authProvider.tsonly requiresissuerUrl(clientSecret is not in the test schema), and the/testhandler never returns 400 — it alwaysc.json(...)at 200 (ok:true/false). Reconciling the title to "returns 200 when clientSecret is omitted" matches genuine route behaviour, not just the assertion.CI — all 6 checks green on head
62c80ca, incl. the previously-flakyCI / Test (pull_request).UAT_PLAYBOOK — no update required; test-hygiene change, no user-facing behaviour affected (PR body confirms).
Scope stayed within the test files; no route behaviour changed. LGTM.