Update header test to use react-test-renderer

This commit is contained in:
Ka-wai Wong 2019-01-24 09:46:09 -08:00
Родитель a6b96b6cf1
Коммит 4d76308666
4 изменённых файлов: 37 добавлений и 1 удалений

28
package-lock.json сгенерированный
Просмотреть файл

@ -9598,6 +9598,12 @@
"schedule": "^0.5.0"
}
},
"react-is": {
"version": "16.7.0",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.7.0.tgz",
"integrity": "sha512-Z0VRQdF4NPDoI0tsXVMLkJLiwEBa+RP66g0xDHxgxysxSoCUccSten4RTF/UFvZF1dZvZ9Zu1sx+MDXwcOR34g==",
"dev": true
},
"react-router": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-4.3.1.tgz",
@ -9640,6 +9646,18 @@
"warning": "^4.0.1"
}
},
"react-test-renderer": {
"version": "16.7.0",
"resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-16.7.0.tgz",
"integrity": "sha512-tFbhSjknSQ6+ttzmuGdv+SjQfmvGcq3PFKyPItohwhhOBmRoTf1We3Mlt3rJtIn85mjPXOkKV+TaKK4irvk9Yg==",
"dev": true,
"requires": {
"object-assign": "^4.1.1",
"prop-types": "^15.6.2",
"react-is": "^16.7.0",
"scheduler": "^0.12.0"
}
},
"read-pkg": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",
@ -10434,6 +10452,16 @@
"object-assign": "^4.1.1"
}
},
"scheduler": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.12.0.tgz",
"integrity": "sha512-t7MBR28Akcp4Jm+QoR63XgAi9YgCUmgvDHqf5otgAj4QvdoBE4ImCX0ffehefePPG+aitiYHp0g/mW6s4Tp+dw==",
"dev": true,
"requires": {
"loose-envify": "^1.1.0",
"object-assign": "^4.1.1"
}
},
"schema-utils": {
"version": "0.4.7",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz",

Просмотреть файл

@ -36,6 +36,7 @@
"identity-obj-proxy": "^3.0.0",
"jest": "^23.6.0",
"prop-types": "^15.6.2",
"react-test-renderer": "^16.7.0",
"regenerator-runtime": "^0.13.1",
"style-loader": "^0.23.0",
"stylelint": "^9.10.1",

Просмотреть файл

@ -1,7 +1,13 @@
import React from 'react';
import renderer from 'react-test-renderer';
import Header from './Header';
describe('Header.js', () => {
it('should render the header', () => {
expect(Header()).toMatchSnapshot();
const tree = renderer
.create(<Header />)
.toJSON();
expect(tree).toMatchSnapshot();
});
});

Просмотреть файл

@ -3,6 +3,7 @@
exports[`Header.js should render the header 1`] = `
<header
className="header"
role="banner"
>
<h1
className="header--text"