Difficulty
Intermediate
Type
refactor, structure, tech-debt
Background
The failing lib/api/mock.ts contains both mock data and API behavior, including analytics data such as MOCK_ANALYTICS_SUMMARY. The module has grown beyond a size where mixing fixtures and functions is easy to maintain.
Problem
Changes to static data require navigating a large behavior-heavy module, while changes to mock functions can accidentally affect fixture definitions or structural boundaries.
Expected outcome
Separate static mock fixtures from functions that consume or expose them, making both easier to review and modify.
Suggested implementation
Identify actual fixture collections in lib/api/mock.ts and move them into a focused fixtures module or directory. Keep mock API functions responsible for retrieving, filtering, transforming, or returning those fixtures. Preserve the current data and public behavior.
Acceptance criteria
- Static fixtures are separated from API behavior where the existing code structure supports the split.
- Mock functions consume fixtures through explicit imports.
- Existing fixture values are preserved.
- No circular dependencies are introduced.
- The application compiles successfully.
Likely affected files/directories
lib/api/mock.ts
lib/api/mock/
lib/api/index.ts
Difficulty
Intermediate
Type
refactor, structure, tech-debt
Background
The failing
lib/api/mock.tscontains both mock data and API behavior, including analytics data such asMOCK_ANALYTICS_SUMMARY. The module has grown beyond a size where mixing fixtures and functions is easy to maintain.Problem
Changes to static data require navigating a large behavior-heavy module, while changes to mock functions can accidentally affect fixture definitions or structural boundaries.
Expected outcome
Separate static mock fixtures from functions that consume or expose them, making both easier to review and modify.
Suggested implementation
Identify actual fixture collections in
lib/api/mock.tsand move them into a focused fixtures module or directory. Keep mock API functions responsible for retrieving, filtering, transforming, or returning those fixtures. Preserve the current data and public behavior.Acceptance criteria
Likely affected files/directories
lib/api/mock.tslib/api/mock/lib/api/index.ts