https://github.com/dadi/test-tools
https://github.com/dadi/test-tools
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/dadi/test-tools
- Owner: dadi
- Created: 2019-06-26T10:52:50.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-26T14:20:18.000Z (almost 7 years ago)
- Last Synced: 2025-02-05T21:53:43.201Z (over 1 year ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Test tools
## API data script
Tests a snapshot of database operations against an API data connector, using Mocha.
### Usage
```js
const { apiDataScript } = require('@dadi/test-tools')
const MyDataConnector = require('/path/to/your/data-connector')
describe.only(
'Data script',
apiDataScript({
// The constructor for the data connector being tested.
Connector: MyDataConnector,
// The contents of the data script.
script: fs.readFileSync('/path/to/your/data-snapshot', 'utf8'),
// The interval (in milliseconds) between each test. Defaults to 5.
testDelay: 5
})
)
```
To pull the latest snapshot from the API repo, run:
```
npm run download-api-snapshot -- /target/directory
```
This will download `data.apisnapshot` and save it on `/target/directory`.