Skip to content

Commit

Permalink
Merge pull request #2602 from metasfresh/dev-master-window
Browse files Browse the repository at this point in the history
Changes to MasterWindow, tests etc
  • Loading branch information
siemiatj committed Feb 14, 2020
2 parents b08eef8 + 0afb55f commit 485dff9
Show file tree
Hide file tree
Showing 21 changed files with 5,097 additions and 105 deletions.
29 changes: 16 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"start": "node server.js",
"storybook": "node .storybook/findStories && start-storybook -p 6006",
"stylelint": "stylelint 'src/assets/**/*.css'",
"test:watch": "jest --watch --verbose false",
"test": "jest"
"test:watch": "jest --watch --verbose false --env=./test_setup/custom_test_env.js",
"test": "jest --env=./test_setup/custom_test_env.js"
},
"jest": {
"setupFiles": [
Expand Down Expand Up @@ -62,7 +62,7 @@
"babel-jest": "25.1.0",
"babel-loader": "8.0.6",
"babel-plugin-dynamic-import-node": "2.3.0",
"better-docs": "^1.1.6",
"better-docs": "1.1.6",
"common-tags": "1.8.0",
"css-loader": "1.0.1",
"enzyme": "3.11.0",
Expand All @@ -83,10 +83,11 @@
"jest": "24.7.1",
"jest-enzyme": "7.0.2",
"jest-localstorage-mock": "2.4.0",
"jsdoc": "^3.6.3",
"jsdoc": "3.6.3",
"jsdom": "15.2.1",
"json-loader": "0.5.7",
"merge": "^1.2.1",
"merge": "1.2.1",
"mock-socket": "9.0.3",
"moment-locales-webpack-plugin": "1.1.2",
"moment-timezone-data-webpack-plugin": "1.1.0",
"nock": "11.7.2",
Expand All @@ -104,18 +105,20 @@
"redux-mock-store": "1.5.4",
"style-loader": "0.23.1",
"stylelint": "13.0.0",
"wait-for-expect": "3.0.2",
"webpack": "4.2.0",
"webpack-cli": "3.3.10",
"webpack-dev-server": "3.3.1",
"webpack-node-externals": "1.7.2",
"why-did-you-update": "1.0.6"
},
"dependencies": {
"@fullcalendar/core": "^4.3.1",
"@fullcalendar/daygrid": "^4.3.0",
"@fullcalendar/interaction": "^4.3.0",
"@fullcalendar/react": "^4.3.0",
"@fullcalendar/timegrid": "^4.3.0",
"@fullcalendar/core": "4.3.1",
"@fullcalendar/daygrid": "4.3.0",
"@fullcalendar/interaction": "4.3.0",
"@fullcalendar/react": "4.3.0",
"@fullcalendar/timegrid": "4.3.0",
"@stomp/stompjs": "5.4.3",
"@zxing/library": "0.12.3",
"axios": "0.19.0",
"bootstrap": "4.3.1",
Expand All @@ -127,7 +130,7 @@
"d3": "4.10.0",
"detect-browser": "4.8.0",
"file-loader": "2.0.0",
"google-map-react": "^1.1.5",
"google-map-react": "1.1.5",
"immutability-helper": "2.1.2",
"immutable": "4.0.0-rc.12",
"intro.js": "2.7.0",
Expand All @@ -138,8 +141,8 @@
"moment-timezone": "0.5.27",
"numeral": "2.0.6",
"object-hash": "2.0.1",
"pigeon-maps": "^0.14.0",
"pigeon-marker": "^0.3.4",
"pigeon-maps": "0.14.0",
"pigeon-marker": "0.3.4",
"prop-types": "15.7.2",
"quagga": "0.12.1",
"query-string": "6.9.0",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/actions/WindowActions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('WindowActions synchronous', () => {
});

describe('WindowActions thunks', () => {
const propsData = masterWindowProps.data1;
const propsData = masterWindowProps.props1;
const middlewares = [thunk];
const mockStore = configureStore(middlewares);

Expand Down
55 changes: 55 additions & 0 deletions src/__tests__/components/table/TableItem.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import React from 'react';
import { shallow, render } from 'enzyme';
import renderer from 'react-test-renderer';

import fixtures from '../../../../test_setup/fixtures/table_item_props.json'

import TableItem from '../../../components/table/TableItem';

function createInitProps(propsSeed = fixtures.oldProps1, customProps){
return {
...propsSeed,
onClick: jest.fn(),
handleSelect: jest.fn(),
onDoubleClick: jest.fn(),
changeListenOnTrue: jest.fn(),
handleRowCollapse: jest.fn(),
handleRightClick: jest.fn(),
onItemChange: jest.fn(),
changeListenOnFalse: jest.fn(),
getSizeClass: jest.fn(),
...customProps,
};
}

describe('Table row (TableItem)', () => {
it('renders without errors', () => {
const props = createInitProps();;

shallow(<TableItem {...props} />);
});

it('output matches snapshot', () => {
const props = createInitProps();

const component = renderer.create(<TableItem {...props} />);
const tree = component.toJSON();
expect(tree).toMatchSnapshot();
});

it('row re-renders after data changed', () => {
const props = createInitProps();
const updatedProps = createInitProps(fixtures.newProps1);
const table = document.createElement('table');
const tbody = document.createElement('tbody');
table.appendChild(tbody);

const wrapper = mount(<TableItem {...props} />, { attachTo: tbody });

expect(wrapper.find('.row-1 [data-cy="cell-QtyEntered"]').text()).toEqual('3');

wrapper.setProps(updatedProps);

expect(wrapper.find('.row-1 [data-cy="cell-QtyEntered"]').text()).toEqual('4');
});
});
Loading

0 comments on commit 485dff9

Please sign in to comment.