Skip to content

Commit 76d8c52

Browse files
author
Emmanouil Konstantinidis
committed
Test navigation component
1 parent 1cb9b9f commit 76d8c52

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/js/__tests__/components/navigation.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,15 @@ describe('Test for Navigation', function () {
5050
expect(instance.refreshNotifications).toBeDefined();
5151
expect(instance.refreshDone).toBeDefined();
5252
expect(instance.logOut).toBeDefined();
53+
expect(instance.goBack).toBeDefined();
54+
expect(instance.goToSettings).toBeDefined();
55+
expect(instance.appQuit).toBeDefined();
5356

5457
var logoutIcon = TestUtils.scryRenderedDOMComponentsWithClass(instance, 'fa-sign-out');
5558
expect(logoutIcon.length).toBe(0);
5659

60+
var quitIcon = TestUtils.scryRenderedDOMComponentsWithClass(instance, 'fa-power-off');
61+
expect(quitIcon.length).toBe(1);
5762
});
5863

5964
it('Should load the navigation component for logged in users', function () {
@@ -71,6 +76,9 @@ describe('Test for Navigation', function () {
7176
expect(instance.refreshNotifications).toBeDefined();
7277
expect(instance.refreshDone).toBeDefined();
7378
expect(instance.logOut).toBeDefined();
79+
expect(instance.goBack).toBeDefined();
80+
expect(instance.goToSettings).toBeDefined();
81+
expect(instance.appQuit).toBeDefined();
7482

7583
var logoutIcon = TestUtils.scryRenderedDOMComponentsWithClass(instance, 'fa-sign-out');
7684
expect(logoutIcon.length).toBe(1);
@@ -86,6 +94,9 @@ describe('Test for Navigation', function () {
8694
instance.refreshDone();
8795
expect(instance.state.loading).toBeFalsy();
8896

97+
// Quit Application
98+
instance.appQuit();
99+
89100
});
90101

91102
it('Should test the refreshNotifications method', function () {
@@ -119,4 +130,24 @@ describe('Test for Navigation', function () {
119130

120131
});
121132

133+
it('Should test the transitions', function () {
134+
135+
spyOn(Actions, 'getNotifications');
136+
137+
AuthStore.authStatus = function () {
138+
return true;
139+
};
140+
141+
var instance;
142+
React.withContext({router: new Router()}, function () {
143+
instance = TestUtils.renderIntoDocument(<Navigation />);
144+
});
145+
146+
expect(instance.componentDidMount).toBeDefined();
147+
148+
instance.goBack();
149+
instance.goToSettings();
150+
151+
});
152+
122153
});

0 commit comments

Comments
 (0)