Skip to content

Split oversized mock API implementation into focused modules #383

Description

@Lakes41

Difficulty

Intermediate

Type

refactor, structure, tech-debt

Background

lib/api/mock.ts is at least 2,117 lines long and currently contains enough unrelated mock API behavior that a single structural mistake prevents the entire API layer from compiling. The parser failure in this file also affects consumers such as lib/api/index.ts and components/nav.tsx.

Problem

Keeping a large collection of mock data and mock API implementations in one file makes structural errors difficult to locate and increases the blast radius of small changes.

Expected outcome

Organize the existing mock API implementation into smaller modules with clear responsibilities while preserving the public API consumed through lib/api/index.ts.

Suggested implementation

Identify logical groups within lib/api/mock.ts, such as analytics data, resource access data, navigation-related mocks, and other API domains actually present in the file. Move each cohesive group into an appropriately named module under lib/api/mock/ or the repository's existing API structure. Keep lib/api/index.ts as the stable aggregation point where practical.

Acceptance criteria

  • The oversized mock implementation is divided according to actual domains present in lib/api/mock.ts.
  • No mock behavior is removed during the refactor.
  • Existing imports through lib/api/index.ts continue to work.
  • No module contains unrelated mock domains merely to reduce line count.
  • The root application compiles successfully after the refactor.

Likely affected files/directories

  • lib/api/mock.ts
  • lib/api/mock/ (new modules as appropriate)
  • lib/api/index.ts

Metadata

Metadata

Assignees

Labels

Third CampaignOfficial FWC26 campaign issue — eligible for campaign scoring and rewardsintermediateIntermediate difficulty tasks requiring solid experience and some contextrefactorCode restructuring without changing external behavior or APItech-debtTechnical debt reduction, maintenance improvements, and deferred cleanup work

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions