Socket
Socket
Sign inDemoInstall

jest-expect-openapi

Package Overview
Dependencies
600
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jest-expect-openapi

Jest/Vitest matcher for asserting valid OpenAPI definitions


Version published
Maintainers
1
Install size
3.69 MB
Created

Readme

Source

jest-expect-openapi

A Jest custom matcher for asserting valid OpenAPI definitions. Also supports Vitest.

npm Build

ReadMe Open Source

Installation

npm install jest-expect-openapi --save-dev

Usage

import toBeAValidOpenAPIDefinition from 'jest-expect-openapi';

expect.extend({ toBeAValidOpenAPIDefinition });

test('should be a valid OpenAPI definition', () => {
  expect(oas).toBeAValidOpenAPIDefinition();
});

test('should not be a valid OpenAPI definition', () => {
  expect(invalidOas).not.toBeAValidOpenAPIDefinition();
});

The usage is nearly identical in Vitest:

import toBeAValidOpenAPIDefinition from 'jest-expect-openapi';
import { expect, test } from 'vitest';

expect.extend({ toBeAValidOpenAPIDefinition });

test('should be a valid OpenAPI definition', () => {
  expect(oas).toBeAValidOpenAPIDefinition();
});

test('should not be a valid OpenAPI definition', () => {
  expect(invalidOas).not.toBeAValidOpenAPIDefinition();
});

Keywords

FAQs

Last updated on 19 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc