Skip to content

portfolioStore has no tests: portfolio aggregation state is uncovered #909

Description

@nanaf6203-bit

portfolioStore has no tests: portfolio aggregation state is uncovered

Labels / Complexity: testing · Medium Complexity — Medium

Problem

portfolioStore (src/store/portfolioStore.ts) holds the aggregated portfolio the dashboard renders. It has no tests — and it is the store that will consume the mock-backed PortfolioService (#20), so its behavior must be pinned before the data source changes.

Why this is architecturally hard

  1. Aggregation is the test design. The store merges holdings/values into the dashboard's derived state; tests must pin how partial data is combined.
  2. It is the mock-migration seam. With issue14 #20 replacing mock holdings, tests written now freeze the store's contract so the migration cannot silently change what the dashboard shows.

Acceptance criteria

  • Tests cover portfolio load, aggregation, and empty/error states.
  • Tests run in CI via npm test.

Out of scope

The portfolio mock migration (#20); other stores.

Getting started

  • src/store/portfolioStore.ts — the store
  • src/store/__tests__/transactionStore.test.ts — the pattern

Commands: npm test.

Good first files to read: src/store/portfolioStore.ts.

Activity

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions