We currently - now after jest has been landed in #7455 - have a mix of different assertion methods in tests.
- There is
chai in use.
- There is
assert in use.
- There is jests
expect in use.
The first two should be removed and rewritten to make use of expect which comes with jest.
so for example
-import chai from "chai";
-import assert from "assert";
-
-chai.expect(actualCode).to.be.equal("var fn;");
+expect(actualCode).toBe("var fn;")
-assert.strictEqual(this.constructor, Bar);
+expect(this.constructor).toBe(Bar)
The jest matchers should be used as good as possible, so for example not expect(x >= 3).toBe(true) but instead expect(x).toBeGreaterThanOrEqual(3)
The doc of jests matchers is here: https://facebook.github.io/jest/docs/en/expect.html
As we have a lot of tests split up in a lot of packages this task can also be split up and only one/some package(s) at a time be migrated.
We currently - now after jest has been landed in #7455 - have a mix of different assertion methods in tests.
chaiin use.assertin use.expectin use.The first two should be removed and rewritten to make use of
expectwhich comes with jest.so for example
The jest matchers should be used as good as possible, so for example not
expect(x >= 3).toBe(true)but insteadexpect(x).toBeGreaterThanOrEqual(3)The doc of jests matchers is here: https://facebook.github.io/jest/docs/en/expect.html
As we have a lot of tests split up in a lot of packages this task can also be split up and only one/some package(s) at a time be migrated.