test: improve branch coverage across watcher, client, compat, convert#106
Merged
Conversation
Add tests targeting missing branches identified by v8 coverage: - watcher.ts: asyncIterator race condition (stop during Promise constructor), reconnect timer cleared in stop(), subscribe/ scheduleReconnect/reloadAndSubscribe stopped guards, plain-Error wrapping in _loadInitial/_update, stop before start, undefined config response in loadSnapshotForFields, undefined oldValue in processChange - client.ts: withRetryAndMap line 514 (retry enabled with no custom retryableCodes), idempotency key ternary branch exercised for set/setMany/setNull/setNumber via DEADLINE_EXCEEDED retry behavior - compat.ts: sparse array input to trigger ?? 0 guard in compare() - convert.ts: unsupported converter type reaching TypeMismatchError runtime guard at line 74 Branch coverage: 86.92% → 95.05% overall watcher: 75.94% → 92.4%, client: 84.5% → 95.77% compat: 86.2% → 89.65%, convert: 95.31% → 96.87% Closes #102 Co-Authored-By: Claude <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
Test plan
watcher.ts: asyncIterator race condition (stop during Promise constructor), reconnect timer cleared by stop(), stopped guards in subscribe/scheduleReconnect/reloadAndSubscribe, plain-Error wrapping in _loadInitial/_update, stop before start, undefined config response, undefined oldValue in processChangeclient.ts: withRetryAndMap merges default codes when retryableCodes unset (line 514), idempotency key ternary branches for set/setMany/setNull/setNumber — verified via DEADLINE_EXCEEDED retry behaviorcompat.ts: sparse array triggers?? 0guard in compare()convert.ts: unsupported converter type reaches TypeMismatchError runtime guard (line 74)npm run test:coverage— 255 tests pass; overall branch coverage 86.92% → 95.05%Closes #102