Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/catgsmith/jest-tutorial

Various Jest Tests
https://github.com/catgsmith/jest-tutorial

Last synced: about 2 months ago
JSON representation

Various Jest Tests

Awesome Lists containing this project

README

        

# Jest

Jest is a delightful JavaScript Testing Framework

## Installation

Install jest locally

```bash
$ mkdir jest_tutorial
$ cd jest_tutorial
$ npm init -y
$ npm install --save-dev jest
```

In package.json file set `scripts.test` property to `"jest"`

# Axios
For youTube tutorial `Jest Crash Course - Unit Testing in JavaScript`,
using axios to mock up aysnc tests in `function.js`.

```bash
$ npm install --save-dev axios
```

## Usage

```bash
npm test 
```

```bash
npm test mocks
```

```bash
npm test spy-mock-implementation.test
```

```bash
\\ Jest Crash Course - Unit Testing in JavaScript
npm test functions.test
npm test reverseString.test
npm test chunk.test
npm test anagram.test
```

## Resources
https://jestjs.io/docs/en/getting-started.html

Jest Crash Course - Unit Testing in JavaScript
Tutorial : https://www.youtube.com/watch?v=7r4xVDI2vho

Testing with Jest: From zero to hero
Tutorial : https://www.youtube.com/watch?v=NHMIn723hQY
See : zeroToHero.test.js

Blog: Jest .fn() and .spyOn() spy/stub/mock assertion reference
https://codewithhugo.com/jest-fn-spyon-stub-mock/

## License
[MIT](https://claddaghcode.com/licenses/mit/)