Skip to content

Commit f510116

Browse files
committed
Add component tests and snapshots
1 parent 0b28ac5 commit f510116

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`<SideBar /> Unit Tests renders correctly 1`] = `
4+
<div
5+
class="ui sidebar vertical left menu overlay visible navActive"
6+
id="site-sideBar"
7+
>
8+
<div
9+
class="ui accordion"
10+
>
11+
<a
12+
class="item"
13+
href="#!"
14+
onClick={[Function]}
15+
>
16+
<b>
17+
Home
18+
</b>
19+
20+
</a>
21+
22+
<a
23+
class="item"
24+
href="#!"
25+
onClick={[Function]}
26+
>
27+
Virtual Machines
28+
</a>
29+
30+
<a
31+
class="item"
32+
href="#!"
33+
onClick={[Function]}
34+
>
35+
Virtual Networks
36+
</a>
37+
38+
<a
39+
class="item"
40+
href="#!"
41+
onClick={[Function]}
42+
>
43+
Database
44+
</a>
45+
46+
<a
47+
class="item"
48+
href="#!"
49+
onClick={[Function]}
50+
>
51+
Storage
52+
</a>
53+
54+
<a
55+
class="item"
56+
href="#!"
57+
onClick={[Function]}
58+
>
59+
Security
60+
</a>
61+
62+
</div>
63+
64+
</div>
65+
`;
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import TestRenderer from 'react-test-renderer';
2+
import SideBar from '../src/_components/SideBar'
3+
import React from 'react'
4+
5+
6+
describe("<SideBar /> Unit Tests", () => {
7+
8+
it("renders correctly", () => {
9+
var testFunction = jest.fn();
10+
var component = TestRenderer.create( <
11+
SideBar changeSelectedDashboardService = {
12+
testFunction
13+
}
14+
/>
15+
);
16+
expect(component).toMatchSnapshot();
17+
});
18+
});

0 commit comments

Comments
 (0)