https://github.com/dldl/api-fixtures-generator
An API fixtures generator spying fetch requests to generate response files.
https://github.com/dldl/api-fixtures-generator
api es6 fixtures javascript testing
Last synced: 6 months ago
JSON representation
An API fixtures generator spying fetch requests to generate response files.
- Host: GitHub
- URL: https://github.com/dldl/api-fixtures-generator
- Owner: dldl
- License: mit
- Created: 2018-11-24T10:42:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-24T17:38:33.000Z (over 7 years ago)
- Last Synced: 2025-10-26T08:22:15.538Z (8 months ago)
- Topics: api, es6, fixtures, javascript, testing
- Language: JavaScript
- Size: 131 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
API Fixtures generator
======================
This is a super lightweight library to generate fixtures files from all `fetch` requests performed by your frontend.
Files are immediately downloaded to your computer.
You can then use them, for instance, to mock your API calls and perform functional testing of your application.
Usage
-----
Install the lib:
```
npm install --save-dev @dldl/api-fixtures-generator
```
Use the lib, for instance in your `index.js` file (**the file should be loaded *before* any other library so the fetch
function is replaced effectively everywhere in your app**):
```js
import "@dldl/api-fixtures-generator"
// Your application code
```
You may conditionally load the library based on the `NODE_ENV` environment variable to only load this in testing (for
instance by using an already generated fixture file or by generating it on the fly like `Netflix/pollyjs` would do).