Files
2026-05-27 23:29:53 +01:00

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, and checkCompatibility
  • THEN pacts/schema-registry__upstream-registry.json contains 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 === 3 for subject 'orders' before the interaction is replayed

Scenario: Compatibility break fails verification

  • WHEN the registry server's BACKWARD compatibility check returns false for an interaction recorded as true
  • THEN verifyProviderAgainstPact throws TestingContractError with code === "TESTING_CONTRACT.VERIFY.MISMATCH" AND pact:verify fails the build