JSPM

@japa/openapi-assertions

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 212
  • Score
    100M100P100Q93441F
  • License MIT

OpenAPI Assertions plugin for Japa

Package Exports

  • @japa/openapi-assertions

Readme

@japa/openapi-assertions


gh-workflow-image npm-image license-image

Introduction

This package contains the OpenAPI Assertion tests that used to be included in @japa/assert

Installation

Install the package from the npm registry as follows:

npm i -D @japa/openapi-assertions

yarn add -D @japa/openapi-assertions

Official Documentation

You can use the assertion package with the @japa/runner as follows, registering an OpenAPI Schema:

import { openapi } from '@japa/openapi-assertions'

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

In tests you can validate API responses using the assert.isValidApiResponse method.

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

Contributing

One of the primary goals of japa is to have a vibrant community of users and contributors who believes in the principles of the framework.

We encourage you to read the contribution guide before contributing to the framework.

Code of Conduct

In order to ensure that the japa community is welcoming to all, please review and abide by the Code of Conduct.

License

@japa/openapi-assertions is open-sourced software licensed under the MIT license.