@apimatic/test-utilities
v0.0.3
Published
provides the assertion utilities
Downloads
265
Keywords
Readme
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:
- getStreamData: Get streaming data from a given URL.
- toBuffer: Promise to create a Buffer instance from a NodeJS.ReadableStream or Blob.
- expectHeadersToMatch: Compare actual headers with expected headers, ignoring case sensitivity.
- 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:
- Node.js v10+
- Bundlers like Rollup or Webpack
- 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.