Skip to content

Commit

Permalink
Tests: Replace chai + sinon with jest
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Jan 29, 2019
1 parent caac649 commit d6253d6
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 144 deletions.
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,19 @@
"@babel/preset-env": "^7.2.3",
"@babel/preset-react": "^7.0.0",
"@overlookmotel/eslint-config": "^1.1.0",
"@overlookmotel/eslint-config-jest": "^1.0.0",
"@overlookmotel/eslint-config-react": "^1.0.0",
"@overlookmotel/eslint-config-tests": "^1.0.2",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.6.0",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"coveralls": "^3.0.2",
"cross-env": "^5.2.0",
"eslint": "^5.12.1",
"eslint-plugin-chai-friendly": "^0.4.1",
"eslint-plugin-eslint-comments": "^3.0.1",
"eslint-plugin-jest": "^22.1.3",
"eslint-plugin-react": "^7.12.4",
"jest": "^23.6.0",
"prop-types": "^15.6.2",
"react": "^16.7.0",
"sinon": "^7.2.3",
"sinon-chai": "^3.3.0"
"react": "^16.7.0"
},
"keywords": [
"react",
Expand Down
2 changes: 1 addition & 1 deletion test/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module.exports = {
extends: [
'@overlookmotel/eslint-config-tests',
'@overlookmotel/eslint-config-jest',
'@overlookmotel/eslint-config-react'
]
};
29 changes: 14 additions & 15 deletions test/context.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
// Modules
const React = require('react'),
{Suspense} = React,
PropTypes = require('prop-types'),
{expect} = require('chai');
PropTypes = require('prop-types');

// Imports
const {itRenders, lazy, removeSpacing} = require('./utils');

// Tests

describe('Context propogates with', () => {
describe('context propogates with', () => {
describe('new Context API', () => {
tests(() => React.createContext('default'));
});
Expand Down Expand Up @@ -81,7 +80,7 @@ function tests(makeContext) {
);

const h = await render(e);
expect(h).to.equal('val');
expect(h).toBe('val');
});

itRenders('multiple boundaries', async ({render}) => {
Expand All @@ -98,7 +97,7 @@ function tests(makeContext) {
);

const h = await render(e);
expect(h).to.equal('val');
expect(h).toBe('val');
});
});

Expand Down Expand Up @@ -128,7 +127,7 @@ function tests(makeContext) {
);

const h = await render(e);
expect(h).to.equal(removeSpacing(`
expect(h).toBe(removeSpacing(`
<div${openTag}>
<div>val</div>
<div>val2</div>
Expand Down Expand Up @@ -159,7 +158,7 @@ function tests(makeContext) {
);

const h = await render(e);
expect(h).to.equal(removeSpacing(`
expect(h).toBe(removeSpacing(`
<div${openTag}>
<div>val</div>
<div>val2</div>
Expand Down Expand Up @@ -187,7 +186,7 @@ function tests(makeContext) {
);

const h = await render(e);
expect(h).to.equal('val');
expect(h).toBe('val');
});

itRenders('multiple lazy components', async ({render}) => {
Expand All @@ -198,7 +197,7 @@ function tests(makeContext) {
);

const h = await render(e);
expect(h).to.equal('val');
expect(h).toBe('val');
});
});

Expand Down Expand Up @@ -235,7 +234,7 @@ function tests(makeContext) {
);

const h = await render(e);
expect(h).to.equal(removeSpacing(`
expect(h).toBe(removeSpacing(`
<div${openTag}>
<div>
<div>val</div>
Expand All @@ -260,7 +259,7 @@ function tests(makeContext) {
);

const h = await render(e);
expect(h).to.equal(removeSpacing(`
expect(h).toBe(removeSpacing(`
<div${openTag}>
<div>
<div>val</div>
Expand Down Expand Up @@ -295,7 +294,7 @@ function tests(makeContext) {
);

const h = await render(e);
expect(h).to.equal('val');
expect(h).toBe('val');
});

itRenders('in Suspense\'s scope', async ({render}) => {
Expand All @@ -310,7 +309,7 @@ function tests(makeContext) {
);

const h = await render(e);
expect(h).to.equal('val');
expect(h).toBe('val');
});
});

Expand Down Expand Up @@ -347,7 +346,7 @@ function tests(makeContext) {
);

const h = await render(e);
expect(h).to.equal(removeSpacing(`
expect(h).toBe(removeSpacing(`
<div${openTag}>
<div>
<div>val</div>
Expand Down Expand Up @@ -380,7 +379,7 @@ function tests(makeContext) {
);

const h = await render(e);
expect(h).to.equal(removeSpacing(`
expect(h).toBe(removeSpacing(`
<div${openTag}>
<div>
<div>val</div>
Expand Down
Loading

0 comments on commit d6253d6

Please sign in to comment.