Skip to content

Commit

Permalink
fixes test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
christopher-johnson committed Dec 1, 2018
1 parent c0f3197 commit 96a943d
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 43,047 deletions.
11,076 changes: 0 additions & 11,076 deletions minimal_redux_poc/package-lock.json

This file was deleted.

1 change: 1 addition & 0 deletions packages/mirador3-app/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"page": true,
"document": true
},
"parser": "babel-eslint",
"plugins": ["jest"],
"rules": {
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
Expand Down
21,919 changes: 0 additions & 21,919 deletions packages/mirador3-app/package-lock.json

This file was deleted.

7 changes: 4 additions & 3 deletions packages/mirador3-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
"enzyme": "^3.7.0",
"enzyme-adapter-react-16": "^1.7.0",
"eslint": "5.6.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-react-app": "^3.0.5",
"eslint-loader": "2.1.1",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-flowtype": "2.50.1",
"eslint-plugin-import": "2.14.0",
"eslint-plugin-jest": "^22.1.0",
Expand All @@ -45,6 +45,7 @@
"html-webpack-plugin": "4.0.0-alpha.2",
"identity-obj-proxy": "3.0.0",
"jest": "23.6.0",
"jest-canvas-mock": "^1.1.0",
"jest-fetch-mock": "^2.0.1",
"jest-pnp-resolver": "1.0.1",
"jest-resolve": "23.6.0",
Expand Down Expand Up @@ -89,9 +90,9 @@
],
"resolver": "jest-pnp-resolver",
"setupFiles": [
"react-app-polyfill/jsdom"
"jest-canvas-mock"
],
"setupTestFrameworkScriptFile": "./setupTests.js",
"setupTestFrameworkScriptFile": "<rootDir>/src/setupTests.js",
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
"<rootDir>/src/**/?(*.)(spec|test).{js,jsx,ts,tsx}"
Expand Down
1 change: 0 additions & 1 deletion packages/mirador3-app/src/components/Window.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class Window extends Component {
*/
constructor(props) {
super(props);

this.miradorInstanceRef = React.createRef();
}

Expand Down
3 changes: 1 addition & 2 deletions packages/mirador3-app/src/components/test/Window.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ describe('Window', () => {
[window] = store.getState().windows;
wrapper = mount(
<Window store={store} id={window.id} />,
// We need to attach this to something created by our JSDOM instance
{ attachTo: document.getElementById('main') },
{ attachTo: document.body }
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@ import fetch from 'jest-fetch-mock'; // eslint-disable-line import/no-extraneous
import Enzyme from 'enzyme'; // eslint-disable-line import/no-extraneous-dependencies
import Adapter from 'enzyme-adapter-react-16'; // eslint-disable-line import/no-extraneous-dependencies

const jsdom = new JSDOM('<!doctype html><html><body><div id="main"></div></body></html>');
const jsdom = new JSDOM('<!doctype html><html><body></body></html>');
const { window } = jsdom;

function copyProps(src, target) {
Object.defineProperties(target, {
...Object.getOwnPropertyDescriptors(src),
...Object.getOwnPropertyDescriptors(target),
});
}

window.HTMLCanvasElement.prototype.getContext = () => {};
jest.setMock('node-fetch', fetch);
global.fetch = require('jest-fetch-mock'); // eslint-disable-line import/no-extraneous-dependencies
Expand All @@ -16,4 +23,6 @@ global.navigator = {
userAgent: 'node.js',
};

copyProps(window, global);

Enzyme.configure({ adapter: new Adapter() });
Loading

0 comments on commit 96a943d

Please sign in to comment.