test: close the audit coverage gaps - #135
Open
MaxMichel2 wants to merge 1 commit into
Open
MaxMichel2 wants to merge 1 commit into
MaxMichel2 wants to merge 1 commit into
Conversation
MaxMichel2
force-pushed
the
test/networkmock-audit-gaps
branch
from
September 23, 2026 16:33
d70f894 to
e92f942
Compare
MaxMichel2
added this pull request to stack #130
September 23, 2026 16:36
MaxMichel2
force-pushed
the
test/networkmock-audit-gaps
branch
from
September 23, 2026 18:56
e92f942 to
c3ad1b4
Compare
MaxMichel2
force-pushed
the
test/networkmock-audit-gaps
branch
from
September 24, 2026 06:19
c3ad1b4 to
bb816df
Compare
Re-scoped issue #91's gap list against current code before writing anything (the issue predates the OpenAPI migration and named files/classes that no longer exist) and found four of its seven gaps already closed by prior work: - Delay precedence: covered except the "neither declares one -> null" case - extended with one more test (existing test already covers operation-level override and spec-default fallback). - Ambiguous host-match precedence: already fully covered by MockConfigRepositoryTest's two "hosts collide" tests. No action. - Preview/diff bottom sheet: already fully covered by MockResponsePreviewPageTest.kt (the page) and DiffLineUtilsTest.kt (the diff logic it drives). No action. - Response Content-Type/header assertions: already closed by #127 (returnsMockResponse_withDefaultContentTypeHeader / _withDeclaredHeadersAndContentType). No action. Three gaps remained genuinely open: - Real sample spec parsing: no test previously loaded the actual shipped sample specs (sample/network's sample-api.json, jsonplaceholder.json) through the real MockConfigRepository - every existing test uses hand-built inline fixtures, so the shipped sample could silently drift out of sync with what the parser accepts. New RealSampleSpecTest (androidHostTest, since java.io.File isn't available on Kotlin/Native and this is a plain JVM sanity check) reads them directly off disk via a Gradle-configured devview.sampleNetworkResourcesDir system property, computed once at configuration time from rootProject.file(...) so the test doesn't depend on the JVM working directory - deliberately not a compile-time dependency on the sample module, which would invert this module's place in the dependency graph. - Query-parameter matching end-to-end through the Ktor plugin: RequestMatcherTest already covered matchesQueryParams in isolation, but NetworkMockPluginTest had no end-to-end coverage through the actual interception path. KtorPluginTestData's shared spec gains a listUsers operation (?type=user, mirroring the real sample spec's own listUsers) and NetworkMockPluginTest gains a "Query parameter matching" region: matches on the declared value, falls through to network on a different value or a missing param. - Sticky-header status-family grouping: OperationPickerPage's response list already groups by StatusCodeFamily with a sticky header per group, but nothing asserted the header text itself or that responses actually land in distinct groups - NetworkMockOperationSheetTest's existing 200/404 fixture already spans two families, so one added test closes this by asserting both family headers render. CHANGELOG.md documents this as a coverage-closing entry rather than a user-facing change (nothing here alters library behavior).
MaxMichel2
force-pushed
the
test/networkmock-audit-gaps
branch
from
September 24, 2026 15:41
bb816df to
5fc6207
Compare
This branch has not been deployed
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
Implements PR 11 from the NetworkMock backlog handoff: closes the remaining test-coverage gaps tracked in #91.
Per the handoff doc's instruction, I re-scoped each of #91's seven gaps against current code before writing anything — the issue predates the OpenAPI migration and references files/classes that no longer exist (
NetworkMockEndpointScreen→OperationPickerPage,NetworkMockEndpointPreviewBottomSheet.kt→MockResponsePreviewPage.kt).Already covered (verified, not duplicated)
MockConfigRepositoryTest'sfindMatchingMock picks the first spec that has a matching operation when hosts collide/falls through to the next spec...MockResponsePreviewPageTest.kt(page) +DiffLineUtilsTest.kt(diff logic)returnsMockResponse_withDefaultContentTypeHeader/_withDeclaredHeadersAndContentType)Genuinely open — closed by this PR
null" case. Added one test to complete the chain.devview-networkmock-core, newRealSampleSpecTest,androidHostTest) — no test previously loaded the actual shipped specs (sample/network'ssample-api.json,jsonplaceholder.json) through the realMockConfigRepository; every other test uses hand-built inline fixtures, so the shipped sample could silently drift out of sync with what the parser accepts. Reads the files directly off disk via adevview.sampleNetworkResourcesDirsystem property (computed once at Gradle configuration time viarootProject.file(...), so it doesn't depend on the JVM working directory) — deliberately not a compile-time dependency onsample:network, which would invert this module's place in the dependency graph.RequestMatcherTestalready coveredmatchesQueryParamsin isolation, butNetworkMockPluginTesthad no coverage through the actual interception path.KtorPluginTestData's shared spec gains alistUsersoperation (?type=user, mirroring the real sample spec), andNetworkMockPluginTestgains a "Query parameter matching" region (3 tests: matches, wrong value falls through, missing param falls through).OperationPickerPagealready groups responses byStatusCodeFamilywith a sticky header per group, but nothing asserted the header text or that responses land in distinct groups.NetworkMockOperationSheetTest's existing fixture already spans two families (2xx/4xx); one added test asserts both headers render.Testing
MockConfigRepositoryTest: +1 test (delay precedence completion).RealSampleSpecTest(new,androidHostTest): 4 tests — both real sample specs parse, and a representative operation's declared response files all load.NetworkMockPluginTest: +3 tests (query-parameter matching region).NetworkMockOperationSheetTest: +1 test (sticky-header grouping).Verification run locally
:devview-networkmock-core:testAndroidHostTest(commonTest + androidHostTest, incl. newRealSampleSpecTest) — ✅:devview-networkmock-ktor:testAndroidHostTest— ✅:devview-networkmock:compileAndroidDeviceTest— ✅detektFull— ✅:konsist:test— ✅:sample:androidApp:assembleDebug— ✅Closes #91.