Test
integration testing
Unit testing
functional testing
Jest
we hava a xxx.js
create a xxx.test.js


Using Babel
To use Babel, 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" }

Using webpack
Jest can be used in projects that use webpack to manage assets, styles, and compilation.
Common Matchers
The simplest way to test a value is with exact equality.
test('two plus two is four', () => {
expect(2 + 2).toBe(4);
});



describe("A suite is just a function", function() {
var a;
it("and so is a spec", function() {
a = true;
expect(a).toBe(true);
});
});444444
Last updated
Was this helpful?