Skip to content

Commit

Permalink
refactor!: remove api-contract-validator for OpenAPI testing (#5)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: API assertions have been moved to its own package
  • Loading branch information
ThisIsMissEm authored and thetutlage committed Dec 18, 2024
1 parent fc22d08 commit e9ad2ed
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 1,083 deletions.
22 changes: 0 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,6 @@ test('test title', ({ assert }) => {
})
```

## Register open API schemas
You can register open API schema and then assert HTTP responses against.

```ts
configure({
plugins: [assert({
openApi: {
schemas: [new URL('../api-spec.json', import.meta.url)]
}
})]
})
```

Validate response as follows.

```ts
test('get users', ({ assert }) => {
const response = await supertest(baseUrl).get('/users')
assert.isValidApiResponse(response)
})
```

[github-actions-url]: https://github.com/japa/assert/actions/workflows/checks.yml
[github-actions-image]: https://img.shields.io/github/actions/workflow/status/japa/assert/checks.yml?style=for-the-badge "github-actions"

Expand Down
Loading

0 comments on commit e9ad2ed

Please sign in to comment.