Api contract tester
Skill AtulPurohit/Antigravity-Awesome-Skills/plugins/dx-qa-automation/skills/api-contract-tester
Implement consumer-driven contract testing with Pact to ensure API compatibility.From its SKILL.md
npx -y skills add AtulPurohit/Antigravity-Awesome-Skills --skill api-contract-testerAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
1.8 KB, 365 tokens by cl100k_base, as published. Nobody here has run it
API Contract Tester
Purpose
Prevent API breaking changes from reaching production by testing contracts between services.
Pact Contract Testing
Consumer Test
const { Pact, like, term } = require('@pact-foundation/pact');
const provider = new Pact({ consumer: 'WebApp', provider: 'UsersAPI', port: 1234 });
test('GET /users/:id returns user', async () => {
await provider.addInteraction({
state: 'user 123 exists',
uponReceiving: 'a request for user 123',
withRequest: { method: 'GET', path: '/users/123', headers: { Accept: 'application/json' } },
willRespondWith: {
status: 200,
body: {
id: '123',
email: like('[email protected]'),
name: like('John Doe'),
role: term({ generate: 'user', matcher: '^(user|admin)$' }),
},
},
});
const user = await UserService.getUser('123');
expect(user.id).toBe('123');
});
Provider Verification
test('verifies consumers', () =>
new Verifier({
provider: 'UsersAPI',
providerBaseUrl: 'http://localhost:3000',
pactUrls: ['./pacts/WebApp-UsersAPI.json'],
stateHandlers: {
'user 123 exists': () => db.users.upsert({ id: '123', email: '[email protected]' }),
},
}).verifyProvider()
);
Outputs
- Consumer pact tests
- Provider verification setup
- Pact broker configuration
- CI/CD contract testing integration
- Contract versioning strategy
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.