> For the complete documentation index, see [llms.txt](https://gzqsjtu.gitbook.io/workspace/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gzqsjtu.gitbook.io/workspace/test.md).

# Test

## integration testing

## Unit testing

functional testing

## Jest

we hava a xxx.js

create a xxx.test.js

![](/files/-LhhCOs3phLKX_I6c6go)

![](/files/-LhhCTGzaULvWj62E8Om)

#### Using Babel

To use [Babel](http://babeljs.io/), install required dependencies via `yarn`

"dependencies": { "babel-core": "^6.26.3", "babel-jest": "^23.6.0", "babel-preset-env": "^1.7.0", "jest": "^24.0.0" }

![](/files/-LhhChGqfSj8hdG47IAA)

#### Using webpack

Jest can be used in projects that use [webpack](https://webpack.github.io/) to manage assets, styles, and compilation.&#x20;

### Common Matchers

The simplest way to test a value is with exact equality.

```
test('two plus two is four', () => {
  expect(2 + 2).toBe(4);
});
```

![](/files/-Lhhd2zO5jLydIzFFiL9)

![](/files/-LhhkQN87OcqfDahc7jx)

![](/files/-LhhkUOn-tekf4baFO4F)

&#x20;[**Jasmine**](https://jasmine.github.io/)

```
describe("A suite is just a function", function() {
  var a;

  it("and so is a spec", function() {
    a = true;

    expect(a).toBe(true);
  });
});444444
```

<br>
