Merge "Re-enable components tests"
This commit is contained in:
commit
b5a4e13918
|
@ -1,6 +1,7 @@
|
|||
import { IntlProvider } from 'react-intl';
|
||||
import React from 'react';
|
||||
import TestUtils from 'react-addons-test-utils';
|
||||
import { Map } from 'immutable';
|
||||
import { Map, Set } from 'immutable';
|
||||
|
||||
import DeployedNodesTabPane from '../../../js/components/nodes/DeployedNodesTabPane';
|
||||
import store from '../../../js/store';
|
||||
|
@ -15,16 +16,27 @@ let nodes = Map({
|
|||
|
||||
let roles = Map();
|
||||
|
||||
xdescribe('DeployedNodesTabPane component', () => {
|
||||
describe('DeployedNodesTabPane component', () => {
|
||||
let tabPaneVdom;
|
||||
beforeEach(() => {
|
||||
let shallowRenderer = TestUtils.createRenderer();
|
||||
shallowRenderer.render(<DeployedNodesTabPane nodes={nodes} roles={roles} store={store}/>);
|
||||
const intlProvider = new IntlProvider({ locale: 'en' }, {});
|
||||
const { intl } = intlProvider.getChildContext();
|
||||
shallowRenderer.render(
|
||||
<DeployedNodesTabPane.WrappedComponent
|
||||
deployedNodes={nodes.get('deployed')}
|
||||
roles={roles}
|
||||
isFetchingNodes={nodes.get('isFetching')}
|
||||
nodesInProgress={Set()}
|
||||
nodesOperationInProgress={false}
|
||||
store={store}
|
||||
intl={intl}/>
|
||||
);
|
||||
tabPaneVdom = shallowRenderer.getRenderOutput();
|
||||
});
|
||||
|
||||
it('should render NodesTable and pass nodes as data prop', () => {
|
||||
expect(tabPaneVdom.props.children[1].type.name).toEqual('NodesTable');
|
||||
expect(tabPaneVdom.props.children[1].type.displayName).toEqual('InjectIntl(NodesTable)');
|
||||
expect(tabPaneVdom.props.children[1].props.nodes).toEqual(nodes.get('deployed'));
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,32 +1,39 @@
|
|||
import { IntlProvider } from 'react-intl';
|
||||
import React from 'react';
|
||||
import TestUtils from 'react-addons-test-utils';
|
||||
import { Map } from 'immutable';
|
||||
import { Map, Set } from 'immutable';
|
||||
|
||||
import MaintenanceNodesTabPane from '../../../js/components/nodes/MaintenanceNodesTabPane';
|
||||
import store from '../../../js/store';
|
||||
|
||||
let nodes = Map({
|
||||
isFetching: false,
|
||||
maintenance: Map({
|
||||
1: { uuid: 1 },
|
||||
2: { uuid: 2 }
|
||||
})
|
||||
let maintenanceNodes = Map({
|
||||
1: { uuid: 1 },
|
||||
2: { uuid: 2 }
|
||||
});
|
||||
|
||||
let roles = Map();
|
||||
|
||||
xdescribe('MaintenanceNodesTabPane component', () => {
|
||||
describe('MaintenanceNodesTabPane component', () => {
|
||||
let tabPaneVdom;
|
||||
beforeEach(() => {
|
||||
let shallowRenderer = TestUtils.createRenderer();
|
||||
shallowRenderer.render(<MaintenanceNodesTabPane nodes={nodes}
|
||||
roles={roles}
|
||||
store={store}/>);
|
||||
const intlProvider = new IntlProvider({ locale: 'en' }, {});
|
||||
const { intl } = intlProvider.getChildContext();
|
||||
shallowRenderer.render(
|
||||
<MaintenanceNodesTabPane.WrappedComponent
|
||||
maintenanceNodes={maintenanceNodes}
|
||||
roles={roles}
|
||||
isFetchingNodes={false}
|
||||
nodesInProgress={Set()}
|
||||
nodesOperationInProgress={false}
|
||||
store={store}
|
||||
intl={intl}/>
|
||||
);
|
||||
tabPaneVdom = shallowRenderer.getRenderOutput();
|
||||
});
|
||||
|
||||
it('should render NodesTable and pass nodes as data prop', () => {
|
||||
expect(tabPaneVdom.props.children[1].type.name).toEqual('NodesTable');
|
||||
expect(tabPaneVdom.props.children[1].props.nodes).toEqual(nodes.get('maintenance'));
|
||||
expect(tabPaneVdom.props.children[1].type.displayName).toEqual('InjectIntl(NodesTable)');
|
||||
expect(tabPaneVdom.props.children[1].props.nodes).toEqual(maintenanceNodes);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { IntlProvider } from 'react-intl';
|
||||
import React from 'react';
|
||||
import TestUtils from 'react-addons-test-utils';
|
||||
|
||||
|
@ -9,7 +10,9 @@ describe('Nodes Component', () => {
|
|||
let NodesVdom, NodesInstance;
|
||||
beforeEach(() => {
|
||||
let shallowRenderer = TestUtils.createRenderer();
|
||||
shallowRenderer.render(<Nodes/>);
|
||||
const intlProvider = new IntlProvider({ locale: 'en' }, {});
|
||||
const { intl } = intlProvider.getChildContext();
|
||||
shallowRenderer.render(<Nodes.WrappedComponent intl={intl}/>);
|
||||
NodesVdom = shallowRenderer.getRenderOutput();
|
||||
NodesInstance = shallowRenderer._instance._instance;
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { IntlProvider } from 'react-intl';
|
||||
import React from 'react';
|
||||
import TestUtils from 'react-addons-test-utils';
|
||||
import { Map, Set } from 'immutable';
|
||||
|
@ -49,15 +50,20 @@ let roles = Map({
|
|||
})
|
||||
});
|
||||
|
||||
// TODO(hpokorny): Re-enable this test once we get rid of PhantomJS
|
||||
xdescribe('NodesTable component', () => {
|
||||
describe('NodesTable component', () => {
|
||||
let nodesTableVdom, nodesTableInstance;
|
||||
beforeEach(() => {
|
||||
let shallowRenderer = TestUtils.createRenderer();
|
||||
shallowRenderer.render(<NodesTable nodes={nodes}
|
||||
roles={roles}
|
||||
nodesInProgress={Set()}
|
||||
isFetchingNodes={false}/>);
|
||||
const intlProvider = new IntlProvider({ locale: 'en' }, {});
|
||||
const { intl } = intlProvider.getChildContext();
|
||||
shallowRenderer.render(
|
||||
<NodesTable.WrappedComponent
|
||||
nodes={nodes}
|
||||
roles={roles}
|
||||
nodesInProgress={Set()}
|
||||
isFetchingNodes={false}
|
||||
intl={intl}/>
|
||||
);
|
||||
nodesTableVdom = shallowRenderer.getRenderOutput();
|
||||
nodesTableInstance = shallowRenderer._instance._instance;
|
||||
});
|
||||
|
@ -67,7 +73,7 @@ xdescribe('NodesTable component', () => {
|
|||
});
|
||||
|
||||
it('should render DataTable and pass data', () => {
|
||||
expect(nodesTableVdom.type.name).toEqual('DataTable');
|
||||
expect(nodesTableVdom.type.displayName).toEqual('InjectIntl(DataTable)');
|
||||
expect(nodesTableVdom.props.data).toEqual(nodes.toList().toJS());
|
||||
expect(nodesTableVdom.props.noRowsRenderer.name).toBeDefined();
|
||||
expect(nodesTableVdom.props.children.length).toEqual(10);
|
||||
|
|
|
@ -1,25 +1,39 @@
|
|||
import { IntlProvider } from 'react-intl';
|
||||
import React from 'react';
|
||||
import TestUtils from 'react-addons-test-utils';
|
||||
import { Map } from 'immutable';
|
||||
import { List, Map, Set } from 'immutable';
|
||||
|
||||
import RegisteredNodesTabPane from '../../../js/components/nodes/RegisteredNodesTabPane';
|
||||
import store from '../../../js/store';
|
||||
|
||||
const nodes = Map({
|
||||
isFetching: false,
|
||||
registered: Map({
|
||||
1: { uuid: 1 },
|
||||
2: { uuid: 2 }
|
||||
})
|
||||
let registeredNodes = Map({
|
||||
1: { uuid: 1 },
|
||||
2: { uuid: 2 }
|
||||
});
|
||||
|
||||
let roles = Map();
|
||||
|
||||
xdescribe('RegisteredNodesTabPane component', () => {
|
||||
describe('RegisteredNodesTabPane component', () => {
|
||||
let tabPaneVdom;
|
||||
beforeEach(() => {
|
||||
let shallowRenderer = TestUtils.createRenderer();
|
||||
shallowRenderer.render(<RegisteredNodesTabPane nodes={nodes} roles={roles} store={store}/>);
|
||||
const intlProvider = new IntlProvider({ locale: 'en' }, {});
|
||||
const { intl } = intlProvider.getChildContext();
|
||||
shallowRenderer.render(
|
||||
<RegisteredNodesTabPane.WrappedComponent.WrappedComponent
|
||||
availableProfiles={List()}
|
||||
deleteNodes={jest.fn()}
|
||||
introspectNodes={jest.fn()}
|
||||
provideNodes={jest.fn()}
|
||||
tagNodes={jest.fn()}
|
||||
registeredNodes={registeredNodes}
|
||||
roles={roles}
|
||||
isFetchingNodes={false}
|
||||
nodesInProgress={Set()}
|
||||
nodesOperationInProgress={false}
|
||||
store={store}
|
||||
intl={intl}/>
|
||||
);
|
||||
tabPaneVdom = shallowRenderer.getRenderOutput();
|
||||
/* TODO(jtomasek): replace this with shallowRenderer.getMountedInstance() when it is available
|
||||
https://github.com/facebook/react/pull/4918/files */
|
||||
|
@ -27,8 +41,8 @@ xdescribe('RegisteredNodesTabPane component', () => {
|
|||
});
|
||||
|
||||
it('should render NodesTable and pass nodes as data prop', () => {
|
||||
expect(tabPaneVdom.props.children[0].props.children[1].type.name).toEqual('NodesTable');
|
||||
expect(tabPaneVdom.props.children[0].props.children[1].props.nodes)
|
||||
.toEqual(nodes.get('registered'));
|
||||
expect(tabPaneVdom.props.children[0].props.children[1].type.displayName)
|
||||
.toEqual('InjectIntl(NodesTable)');
|
||||
expect(tabPaneVdom.props.children[0].props.children[1].props.nodes).toEqual(registeredNodes);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { IntlProvider } from 'react-intl';
|
||||
import { Map } from 'immutable';
|
||||
import React from 'react';
|
||||
import TestUtils from 'react-addons-test-utils';
|
||||
|
@ -7,14 +8,14 @@ import FileList from '../../../js/components/plan/FileList';
|
|||
import { PlanFile } from '../../../js/immutableRecords/plans';
|
||||
import store from '../../../js/store';
|
||||
|
||||
// TODO(jtomasek): re-enable this test once we get rid of PhantomJS and switch to jsdom/jest/enzyme
|
||||
// so we can properly test components
|
||||
xdescribe('ListPlans component', () => {
|
||||
describe('ListPlans component', () => {
|
||||
let output;
|
||||
|
||||
beforeEach(() => {
|
||||
let shallowRenderer = TestUtils.createRenderer();
|
||||
shallowRenderer.render(<ListPlans store={store}/>);
|
||||
const intlProvider = new IntlProvider({ locale: 'en' }, {});
|
||||
const { intl } = intlProvider.getChildContext();
|
||||
shallowRenderer.render(<ListPlans.WrappedComponent store={store} intl={intl}/>);
|
||||
output = shallowRenderer.getRenderOutput();
|
||||
});
|
||||
|
||||
|
|
|
@ -1,12 +1,4 @@
|
|||
// import React from 'react';
|
||||
// import TestUtils from 'react-addons-test-utils';
|
||||
//
|
||||
// const DataTable = require('../../../js/components/ui/tables/DataTable.js');
|
||||
//
|
||||
// describe('DataTable component', () => {
|
||||
// it('should ')
|
||||
// });
|
||||
|
||||
import { FormattedMessage, IntlProvider } from 'react-intl';
|
||||
import React from 'react';
|
||||
import TestUtils from 'react-addons-test-utils';
|
||||
|
||||
|
@ -28,16 +20,19 @@ const mockOnFilter = () => {
|
|||
return 'Filtering Happened';
|
||||
};
|
||||
|
||||
// TODO(hpokorny): Re-enable this test once we get rid of PhantomJS
|
||||
xdescribe('DataTable component', () => {
|
||||
describe('DataTable component', () => {
|
||||
let DataTableVdom, DataTableInstance;
|
||||
beforeEach(() => {
|
||||
let shallowRenderer = TestUtils.createRenderer();
|
||||
const intlProvider = new IntlProvider({ locale: 'en' }, {});
|
||||
const { intl } = intlProvider.getChildContext();
|
||||
shallowRenderer.render(
|
||||
<DataTable data={data}
|
||||
rowsCount={data.length}
|
||||
onFilter={mockOnFilter}
|
||||
noRowsRenderer={mockNoRowsRenderer}>
|
||||
<DataTable.WrappedComponent
|
||||
data={data}
|
||||
rowsCount={data.length}
|
||||
onFilter={mockOnFilter}
|
||||
noRowsRenderer={mockNoRowsRenderer}
|
||||
intl={intl}>
|
||||
<DataTableColumn key="uuid"
|
||||
header={<DataTableHeaderCell key="uuid">UUID</DataTableHeaderCell>}
|
||||
cell={<DataTableDataFieldCell data={data} field="uuid"/>}/>
|
||||
|
@ -46,7 +41,7 @@ xdescribe('DataTable component', () => {
|
|||
Provision State
|
||||
</DataTableHeaderCell>}
|
||||
cell={<DataTableDataFieldCell data={data} field="provision_state"/>}/>
|
||||
</DataTable>
|
||||
</DataTable.WrappedComponent>
|
||||
);
|
||||
DataTableVdom = shallowRenderer.getRenderOutput();
|
||||
DataTableInstance = shallowRenderer._instance._instance;
|
||||
|
@ -62,7 +57,11 @@ xdescribe('DataTable component', () => {
|
|||
expect(tableInfo.props.className).toBe('dataTables_info');
|
||||
expect(tableInfo).toEqual(
|
||||
<div className="dataTables_info">
|
||||
Showing <b>{data.length}</b> of <b>{data.length}</b> items
|
||||
<FormattedMessage
|
||||
defaultMessage="Showing {showing} of {total} items"
|
||||
id="DataTable.itemsVisibleInTable"
|
||||
tagName="span"
|
||||
values={{ showing: <b>{2}</b>, total: <b>{2}</b> }}/>
|
||||
</div>
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue