Skip to content

Add direct unit tests for ARCPClient, ARCPRuntime, JwtAuth, BudgetRegistry, and MemoryTransport #70

@nficano

Description

@nficano

A direct map of source files to test files shows several public, high-traffic classes have no dedicated test class under lib/src/test/kotlin/: ARCPClient.kt (only exercised transitively by tests/src/test/kotlin/dev/arcp/tests/HandshakeTest.kt), ARCPRuntime.kt (same), JwtAuth.kt (no test at all), BudgetRegistry.kt (the per-counter BudgetCounterTest exists but the registry's lifecycle, including terminate clearing both maps, is untested), MemoryTransport.kt (no test), UpstreamErrorTranslator.kt (no test), CapabilityNegotiation.kt (no test — and three open bugs already reference this file: #51 and the new issue above on extension rejection), and CompiledSubscriptionFilter.kt (no test). The tests/ integration suite covers happy paths, but unit tests give cheaper, faster signal on per-method invariants and edge cases. This is distinct from #56, which tracks the aggregate Kover coverage threshold rather than specific test additions.

Fix prompt: For each class listed above add a focused unit test class. Minimum coverage per class: ARCPClient handshake error mapping (rejection codes, unexpected-payload), ARCPRuntime dispatcher behavior for all handleEnvelope branches (covered partially by HandshakeTest), JwtAuth skew tolerance, audience and issuer checks, BudgetRegistry register/consume/terminate/remaining sequence, MemoryTransport ordering, backpressure, and close behavior, UpstreamErrorTranslator mapping rules, CapabilityNegotiation boolean intersection, heartbeat min, binary encoding negotiation (including #51), extensions handling (including the new "do not reject on unknown extensions" rule), and CompiledSubscriptionFilter.matches empty-set semantics, minPriority threshold, and per-field membership. Prefer parameterized tests where the inputs are tabular.

Metadata

Metadata

Assignees

No one assigned

    Labels

    severity:mediumMedium severity issuetestingTest coverage or test infrastructure

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions