Rift.IO OSM R1 Initial Submission
[osm/UI.git] / skyquake / __tests__ / skyquakeRouter_test.js
1 jest.dontMock('../framework/widgets/skyquake_container/skyquakeNav.jsx');
2 // /skyquake/framework/widgets/skyquake_container/skyquakeNav.jsx
3 import React from 'react';
4 import ReactDOM from 'react-dom';
5 import TestUtils from 'react-addons-test-utils';
6
7 // import {returnLinkItem} from '../framework/widgets/skyquake_container/skyquakeNav.jsx';
8
9 const SkyquakeNav = require('../framework/widgets/skyquake_container/skyquakeNav.jsx')
10
11 describe('SkyquakeNav', () => {
12
13 let exampleRoutes;
14 let node;
15 beforeEach(function() {
16 node = document.createElement('div');
17 exampleRoutes = [{
18 "label": "Hello World Component 1",
19 "route": "/helloworld/#hello",
20 "component": "./helloWorldOne.jsx",
21 "path": "",
22 "type": "internal",
23 "isExternal": true
24 },{
25
26 "label": "Hello World Component 1",
27 "route": "hello",
28 "component": "./helloWorldOne.jsx",
29 "path": "",
30 "type": "internal",
31 "isExternal": false
32 }];
33 });
34 describe('returnLinkItem', () => {
35 it('Returns an <a> tag when external', () => {
36 let element = SkyquakeNav.returnLinkItem(exampleRoutes[0]);
37 let Tag = TestUtils.renderIntoDocument(element);
38 let TagNode = ReactDOM.findDOMNode(Tag);
39 expect(Tag.constructor.displayName).toEqual("A");
40 expect(TagNode.attributes.href).not.toEqual(undefined);
41 });
42 it('Returns a <Link> tag when internal', () => {
43 let element = SkyquakeNav.returnLinkItem(exampleRoutes[1]);
44 let Tag = TestUtils.renderIntoDocument(element);
45 let TagNode = ReactDOM.findDOMNode(Tag);
46 expect(TagNode.constructor.displayName).toEqual("Link");
47 expect(TagNode.attributes.href).not.toEqual(undefined);
48 })
49 })
50 })