1.7 KiB
1.7 KiB
ADDED Requirements
Requirement: Consumer-side pact recording
The @suaveplan/schema-registry package SHALL ship a schema-registry.contract.test.ts that uses recordPactInteraction from @suaveplan/testing-contract to record interactions against an upstream registry's lookup, register, and compatibility-check endpoints. The resulting pact file MUST be committed to pacts/schema-registry__upstream-registry.json.
Scenario: Lookup, register, compatibility recorded
- WHEN the consumer-side test exercises
getSchema,registerSchema, andcheckCompatibility - THEN
pacts/schema-registry__upstream-registry.jsoncontains at least one interaction per public method
Requirement: Provider-side pact verification
The @suaveplan/schema-registry package SHALL ship a schema-registry.provider.test.ts that uses verifyProviderAgainstPact from @suaveplan/testing-contract to replay pacts/schema-registry__upstream-registry.json against the registry server implemented by the package itself. Provider states for "subject exists with N versions" SHALL be registered via options.stateHandlers.
Scenario: Provider state seeds version history
- WHEN an interaction declares
providerStates:[{ name:"subject 'orders' has 3 versions" }]AND the corresponding state handler runs - THEN the registry under test reports
versions.length === 3for subject'orders'before the interaction is replayed
Scenario: Compatibility break fails verification
- WHEN the registry server's
BACKWARDcompatibility check returnsfalsefor an interaction recorded astrue - THEN
verifyProviderAgainstPactthrowsTestingContractErrorwithcode === "TESTING_CONTRACT.VERIFY.MISMATCH"ANDpact:verifyfails the build