test: close critical test coverage gaps (+72 tests)#86
Merged
Conversation
Cover all state combinations: watchLoop recording priority, transcriberState branches, activeJobState dispatch, updateAvailable fallback, and priority ordering between tiers.
Test gap just over threshold, overlapping segments, rapid speaker alternation, and threshold constant value assertion.
New test file for Helpers.swift pure functions: zero ticks, positive range, monotonicity, and constant value verification.
VadSegmentMap: past-end mapping, empty segments, segment clamping, remap with speaker/text preservation. NotificationContent: cover recordingDone state.
Test mix() with positive, negative, and zero micDelay using shared mixWithDelay() helper for DRY temp file management.
RecorderError description assertions, multiple tmp file cleanup, empty directory cleanup, and 4-channel downmix edge case.
…Result Change visibility from private to internal for @testable access. Test normalization patterns, result sorting, speaking time computation, empty segments, and nil embeddings.
Verify pipeline completes when one audio source is missing, exercising single-source fallback paths.
Verify stopManualRecording enqueues a PipelineJob and second startManualRecording is no-op while already recording.
Cover completedJobs filter, cancel/update with nonexistent ID, error state transition, and corrupt snapshot resilience.
Cover emptyProtocol, httpError, connectionFailed error descriptions, multi-line SSE content joining, and language substitution.
Verify all fields stored correctly, nil mic URL handling, and mono channel count.
Cover corrupt JSON resilience, empty file handling, missing embedding no-op, three-speakers-two-stored matching, and greedy assignment determinism by sorted key.
e660f41 to
f0a38d5
Compare
…) tests Make URLSession injectable (default .shared) for mock-based testing. Cover: successful SSE streaming, auth header presence/absence, diarized mode, HTTP 503 error, empty response, testConnection success, testConnection HTTP error, and invalid endpoint.
9e78425 to
46fd783
Compare
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
OpenAIProtocolGeneratortestable via injectableURLSession+ MockURLProtocolFluidDiarizer.normalizeSpeakerIdandbuildResultfrom private to internal for testabilityChanges
BadgeKind.compute() — 21 exhaustive tests covering all state combinations (watchLoop priority, transcriberState branches, activeJobState dispatch, updateAvailable fallback)
mergeConsecutiveSpeakers() — boundary tests for gap threshold, overlapping segments, rapid speaker alternation
AudioTapLib Helpers — new test file for
machTicksToSeconds(zero, positive, monotonicity) andspeechSampleRateconstantVadSegmentMap — boundary conditions: past-end mapping, empty segments, segment clamping, remap with speaker/text preservation
AppPaths.migrateIfNeeded() — idempotency tests (no crash on repeated calls)
AudioMixer delay alignment — positive, negative, and zero micDelay via shared
mixWithDelay()helperDualSourceRecorder — RecorderError descriptions, multiple tmp file cleanup, empty directory cleanup, 4-channel downmix
FluidDiarizer — expose
normalizeSpeakerId/buildResultas internal, test normalization patterns, result sorting, speaking times, empty segmentsWorkflow integration — app-only and mic-only fallback paths (single-source pipeline)
WatchLoop — manual recording enqueue and double-start guard
PipelineQueue — completedJobs filter, cancel/update with nonexistent ID, error state transition, corrupt snapshot resilience
OpenAIProtocolGenerator — injectable URLSession, MockURLProtocol-based tests for SSE streaming, auth headers, HTTP errors, empty response,
testConnection()success/errorAudioCaptureResult — field initialization and nil mic URL tests
SpeakerMatcher — corrupt DB resilience, empty file, missing embeddings, three-speakers-two-stored matching, greedy assignment determinism
Test plan
swift testinapp/MeetingTranscriber— 877 tests, 0 unexpected failuresswift testintools/audiotap— 26 tests, 0 failures./scripts/lint.sh— 0 violations