npm @japa/assert 1.3.0
Add support for asserting against open API schema

latest releases: 4.2.0, 4.1.1, 4.1.0...
4 years ago

After this release, you will be able to register the open API schemas and assert API responses against it. Here's a small example.

const config = {
  openApi: {
    schemas: [join(__dirname, '..', 'api-spec.json')],
  },
}

configure({
  plugins: [assert(config)],
})

Validate response as follows.

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

Commits

  • docs(README): add open API assertion example 46ef0e2
  • feat: add support for validating responses against api schema ed7b71f
  • feat: automatically augment TestContext 1c402fd
  • chore: update dependencies 8b71324

v1.2.4...v1.3.0

Don't miss a new assert release

NewReleases is sending notifications on new releases.