Skip to content

Latest commit

 

History

History

test-utilities

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

APIMatic Test Utilities Libary for JavaScript

This library is currently in preview.

Provides assertion utilities for testing api calls. It can be plugged in as dev dependency to any library.

The exported helper functions include:

  1. getStreamData: Get streaming data from a given URL.
  2. toBuffer: Promise to create a Buffer instance from a NodeJS.ReadableStream or Blob.
  3. expectHeadersToMatch: Compare actual headers with expected headers, ignoring case sensitivity.
  4. expectMatchingWithOptions: Check whether the expected value is matching with the actual value, with the given comparison options.

This library is used as a dev-dependency by JavaScript SDKs generated by the APIMatic Code Generator.

Builds

The following environments are supported:

  1. Node.js v10+
  2. Bundlers like Rollup or Webpack
  3. Web browsers

To support multiple environments, we export various builds:

Environment Usage
Common.js Import like this: require('@apimatic/test-utilities').
ES Module Import like this: import { /* your imports */ } from '@apimatic/test-utilities'.
Browsers *Use script: https://unpkg.com/@apimatic/test-utilities@VERSION/umd/schema.js
Modern Browsers (supports ESM and uses modern JS) *Use script: https://unpkg.com/@apimatic/test-utilities@VERSION/umd/schema.esm.js

* Don't forget to replace VERSION with the version number.

Note: We discourage importing files or modules directly from the package. These are likely to change in the future and should not be considered stable.