-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
testWrite or update test filesWrite or update test files
Milestone
Description
Parent
Part of the Testing & Code Quality milestone. Related to #30.
Description
Add edge case and regression tests to harden the library against unexpected inputs and state transitions. These tests prevent future regressions as the codebase evolves.
Edge cases to cover
| Case | Expected behavior |
|---|---|
| Empty feature collection (no features from source) | No markers created, no errors, stale markers cleaned up |
| Non-Point geometry feature | `console.error` logged, feature skipped, rendering continues |
| Cluster with 0 leaves (empty cluster) | `console.error` logged, cluster skipped |
| `loadClusterLeaves` rejection (source error) | Returns `false`, logs warning, rendering aborted gracefully |
| Feature with duplicate IDs in source | Last feature wins in `featuresMap`, no crash |
| Rapid consecutive `moveend` events | Only the final render completes (abort counter works) |
| `onRemove` called before `onAdd` | No-op, no error |
| `setSelectedFeature` called before `onAdd` | Pin marker placed at coordinates (no map interaction) |
| `resetSelectedFeature` when no selection exists | No-op, no error |
| Cluster with leaves exactly at `unfoldedClusterMaxLeaves` | Renders as unfolded (boundary condition) |
| Zoom exactly at `clusterMaxZoom` | All clusters unfold regardless of leaf count |
| Zoom exactly at `clusterMinZoom` | Clusters start unfolding |
| `getFeatureId` with `properties.id = 0` | Returns `"0"`, not falsy |
| `getFeatureId` with neither metadata.id nor properties.id | Currently throws TypeError — document and/or fix |
| `deepMerge` with `null` values in source | Should replace target value with `null` |
Acceptance Criteria
- All edge cases listed above have corresponding tests
- No test relies on implementation details (test behavior, not internals)
- Each edge case test is documented with a comment explaining the scenario
- `yarn test` passes
- `yarn coverage` shows meaningful improvement
Files Likely Involved
- `tests/edge-cases.test.ts` (new)
- `tests/utils/deep-merge.test.ts` (extend)
- `tests/utils/index.test.ts` (extend)
Dependencies
- Blocked by: refactor(test): build comprehensive MapLibre mock #64 (mock), test(utils): unit tests for pure utility functions #62 (utility tests), test(core): renderCustom, feature selection and event dispatch tests #67 (core tests)
- Blocks: none
Parallelizable
no — final tier, builds on all prior test infrastructure
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
testWrite or update test filesWrite or update test files