https://github.com/dominicfraser/nockexamples
HTTP request mocking with Nock
https://github.com/dominicfraser/nockexamples
testing testing-tools
Last synced: over 1 year ago
JSON representation
HTTP request mocking with Nock
- Host: GitHub
- URL: https://github.com/dominicfraser/nockexamples
- Owner: dominicfraser
- Created: 2018-07-08T11:04:46.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-02-03T13:05:03.000Z (over 7 years ago)
- Last Synced: 2025-02-28T22:55:01.659Z (over 1 year ago)
- Topics: testing, testing-tools
- Language: JavaScript
- Size: 70.3 KB
- Stars: 14
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This is an example repo to go along with this ['how to' article](https://codeburst.io/testing-mocking-http-requests-with-nock-480e3f164851).
It uses [Nock](https://github.com/nock/nock) alongside a [Random User API](https://randomuser.me/documentation).
#### Linting:
For linting [eslint-config-skyscanner](https://github.com/Skyscanner/eslint-config-skyscanner ) has been used, along with [prettier](https://github.com/prettier/prettier). This is not included in each directory, if you wish to add it duplicate the [.eslintrc](.eslintrc) and [.prettierrc](.prettierrc) and run:
```sh
(
export PKG=eslint-config-skyscanner;
npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev
"$PKG@latest"
)
```
to setup eslint, and then the following to integrate prettier:
```sh
npm install -D eslint-config-prettier eslint-plugin-prettier prettier
```