wil-api-test

1.3.0 • Public • Published

API test

npm

npm install wil-api-test --save-dev

yarn

yarn add wil-api-test --save-dev

Example

package.json

"scripts": {
  ...
  "api-test": "wil-api-test src --baseURL axios_base_url"
}

Create file testing: example foo.test.api.js

<@received>
  // using axios ( not import )
  const { data } = axios.get("API ENDPOINT OR URL");
  const result = data[0];
  return result;
</@received>

<@expected>
{
  "userId": 1,
  "id": 1,
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
  "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
}
</@expected>
Cli test all files yarn api-test or npm run api-test
Cli test only file yarn api-test --file foo.test.api.js or npm run api-test --file foo.test.api.js

Readme

Keywords

Package Sidebar

Install

npm i wil-api-test

Weekly Downloads

2

Version

1.3.0

License

MIT

Unpacked Size

6.95 kB

Total Files

10

Last publish

Collaborators

  • longnguyen