Skip to content

Commit

Permalink
docs: adds readme to test-helper package
Browse files Browse the repository at this point in the history
  • Loading branch information
asadali214 committed Jul 18, 2024
1 parent baf65b8 commit 5653e73
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 11 deletions.
11 changes: 0 additions & 11 deletions packages/test-helper/CHANGELOG.md

This file was deleted.

37 changes: 37 additions & 0 deletions packages/test-helper/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# APIMatic Test Helper 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. **areStreamsMatching**: Check if input matches the contents of a file by comparing stream data or Blob data.
3. **expectHeadersToMatch**: Compare actual headers with expected headers, ignoring case sensitivity.
4. **isProperSubsetOf**: Recursively check whether the left object or array is a proper subset of the right object or array.
5. **isOrderedSupersetOf**: Check if one ordered array is a superset of another ordered array.
6. **isSuperSetOf**: Check if one array is a superset of another array.

This library is used as a dev-dependency by JavaScript SDKs generated by the [APIMatic Code Generator](http://www.apimatic.io).

## Builds

The following environments are supported:

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

To support multiple environments, we export various builds:

| Environment | Usage |
| --- | --- |
| Common.js | Import like this: `require('@apimatic/test-helper')`. |
| ES Module | Import like this: `import { /* your imports */ } from '@apimatic/test-helper'`. |
| Browsers | *Use script: `https://unpkg.com/@apimatic/test-helper@VERSION/umd/schema.js` |
| Modern Browsers (supports ESM and uses modern JS) | *Use script: `https://unpkg.com/@apimatic/test-helper@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.

0 comments on commit 5653e73

Please sign in to comment.