describe('NodeDetails', () => { let NodeDetails; let nodes; let nodeId; let details; const React = require('react'); const Immutable = require('immutable'); const TestUtils = require('react/lib/ReactTestUtils'); beforeEach(() => { NodeDetails = require('../node-details.js'); nodes = Immutable.OrderedMap(); nodeId = 'n1'; }); it('shows n/a when node was not found', () => { const c = TestUtils.renderIntoDocument(); const notFound = TestUtils.findRenderedDOMComponentWithClass(c, 'node-details-header-notavailable'); expect(notFound).toBeDefined(); }); it('show label of node with title', () => { nodes = nodes.set(nodeId, Immutable.fromJS({id: nodeId})); details = {label_major: 'Node 1', tables: []}; const c = TestUtils.renderIntoDocument(); const title = TestUtils.findRenderedDOMComponentWithClass(c, 'node-details-header-label'); expect(title.getDOMNode().textContent).toBe('Node 1'); }); });