Merged
Conversation
- Added validation tests for null/non-object routes in defineResource - Added tests for all default cache key generators (create/update/remove) - Added edge case tests for development environment warnings in invalidate - Added tests for event emission edge cases and error paths Coverage improvements: - Statements: 80.16% → 97.2% - Branches: 78.24% → 89.65% - Functions: 63.63% → 95.4% - Lines: 80.3% → 97.45% Configuration updates: - Excluded showcase app from coverage (example code, not framework) - Excluded index.ts export files from coverage (trivial re-exports) - Enforced coverage thresholds in jest.config.cjs Test results: - 287 tests passing (9 new tests added) - All coverage thresholds met Closes #28 (C1: Unit Tests)
**C1: Unit Test Coverage Improvements** - Added validation tests for null/non-object routes in defineResource - Added tests for all default cache key generators (create/update/remove) - Added edge case tests for development environment warnings in invalidate - Added tests for event emission edge cases and error paths **C2: Integration Tests** - Created resource-flow.test.ts with 14 comprehensive integration tests - Tests cover complete resource → store → resolver flow - Validates REST endpoint mocking and transport integration - Tests error handling and propagation - Validates cache key generation across CRUD operations - Verifies store configuration (selectors, resolvers, actions) **Coverage Results:** - Statements: 80.16% → **97.2%** (+17.04%) - Branches: 78.24% → **90.08%** (+11.84%) - Functions: 63.63% → **95.4%** (+31.77%) - Lines: 80.3% → **97.45%** (+17.15%) **Test Results:** - 301 tests passing (+14 new integration tests) - All coverage thresholds enforced in jest.config.cjs **Configuration Updates:** - Excluded showcase app from coverage (example code, not framework) - Excluded index.ts export-only files (trivial re-exports) - Set coverage thresholds: 90% statements/functions/lines, 89% branches Closes #28 (C1: Unit Tests) Closes #29 (C2: Integration Tests)
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR completes Sprint 1's unit test coverage goals by adding comprehensive edge case testing for cache invalidation and resource definition validation. The changes boost test coverage from 80% to 97%+ across all metrics, meeting the >90% coverage targets.
Key changes:
- Added new edge case tests for cache invalidation behavior in development vs production environments
- Enhanced resource definition validation tests for null/non-object route handling
- Added integration tests covering the complete resource flow from definition to store population
- Updated Jest configuration to enforce coverage thresholds and exclude showcase/example code
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
packages/kernel/src/resource/__tests__/invalidate-edge-cases.test.ts |
New comprehensive test file covering development warnings, production silent failures, and event emission edge cases |
packages/kernel/src/resource/__tests__/defineResource.test.ts |
Added validation tests for null/non-object routes and default cache key generation for all CRUD operations |
packages/kernel/src/__tests__/integration/resource-flow.test.ts |
New integration test suite covering complete resource-to-store flow with mocked REST endpoints |
jest.config.cjs |
Updated coverage configuration to exclude showcase app and enforce 89-90% coverage thresholds |
pipewrk
added a commit
that referenced
this pull request
Nov 8, 2025
…n-tests Sprint 1/c1 c2 unit integration tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Completes Sprint 1 C1: Unit test coverage for kernel primitives.
Closes #11
Closes #12
Coverage Improvements
New Tests Added
defineResource.test.ts
invalidate-edge-cases.test.ts (NEW)
Configuration Updates
jest.config.cjs:
Test Results
Files Changed
Sprint 1 Progress
Progress: 12/14 tasks (86%)"
--base main
--head sprint-1/c1-c2-unit-integration-tests