// BalanceOnboardingCard — unit tests (issue #178) // // NOTE: This project does not have @testing-library/react or jsdom configured // (logged as MEDIUM in autopilot decisions-log). Tests cover the pure // `deriveOnboardingSteps` helper that drives the visual state of each step. // All React rendering is bypassed. import { describe, it, expect } from "vitest"; import { deriveOnboardingSteps } from "./BalanceOnboardingCard"; describe("BalanceOnboardingCard — deriveOnboardingSteps", () => { it("0 accounts, 0 snapshots → step1 active, step2 disabled", () => { const r = deriveOnboardingSteps(0, 0); expect(r.step1).toBe("active"); expect(r.step2).toBe("disabled"); }); it(">=1 account, 0 snapshots → step1 done, step2 active", () => { const r = deriveOnboardingSteps(1, 0); expect(r.step1).toBe("done"); expect(r.step2).toBe("active"); const r2 = deriveOnboardingSteps(5, 0); expect(r2.step1).toBe("done"); expect(r2.step2).toBe("active"); }); it(">=1 account, >=1 snapshot → both done (defensive — card normally hidden)", () => { const r = deriveOnboardingSteps(2, 3); expect(r.step1).toBe("done"); expect(r.step2).toBe("done"); }); it("guard: 0 accounts but >=1 snapshot (anomaly) → step1 active, step2 done", () => { // This combination should not happen in practice (a snapshot requires at // least one account), but the helper handles it conservatively. const r = deriveOnboardingSteps(0, 1); expect(r.step1).toBe("active"); expect(r.step2).toBe("done"); }); });