Update app tests

This commit is contained in:
kiswa 2016-08-25 10:38:39 +00:00
parent a6f23951a5
commit a6dcab34f2
3 changed files with 23 additions and 9 deletions

View File

@ -108,22 +108,34 @@ global.SettingsServiceMock = function() {
var userList = [ var userList = [
{ id: 1, username: 'tester', security_level: 2 }, { id: 1, username: 'tester', security_level: 2 },
{ id: 2, username: 'test', security_level: 3, default_board_id: 0 } { id: 2, username: 'test', security_level: 3, default_board_id: 0 }
],
boardsList = [
{ id: 1, name: 'Testing' }
]; ];
return { return {
usersChanged: RxJs.Observable.of(userList), usersChanged: RxJs.Observable.of(userList),
boardsChanged: RxJs.Observable.of(boardsList),
updateUsers: (users) => { updateUsers: (users) => {
userList = [];
userList = users; userList = users;
}, },
getUsers: () => { getUsers: () => {
return RxJs.Observable.of({ return RxJs.Observable.of({
status: 'success', status: 'success',
alerts: [], alerts: [],
data: [ data: [ null, userList ]
null, });
userList },
]
updateBoards: (boards) => {
boardsList = boards;
},
getBoards: () => {
return RxJs.Observable.of({
status: 'success',
alerts: [],
data: [ null, boardsList ]
}); });
} }
}; };

View File

@ -1,4 +1,4 @@
/* global expect AuthServiceMock SettingsServiceMock ModalServiceMock */ /* global expect AuthServiceMock SettingsServiceMock ModalServiceMock NotificationsServiceMock */
var path = '../../../../build/settings/board-admin/', var path = '../../../../build/settings/board-admin/',
BoardAdmin = require(path + 'board-admin.component.js').BoardAdmin, BoardAdmin = require(path + 'board-admin.component.js').BoardAdmin,
DragulaService = require('../../../../node_modules/ng2-dragula/src/app/providers/dragula.provider.js') DragulaService = require('../../../../node_modules/ng2-dragula/src/app/providers/dragula.provider.js')
@ -9,7 +9,8 @@ describe('BoardAdmin', () => {
beforeEach(() => { beforeEach(() => {
boardAdmin = new BoardAdmin(AuthServiceMock, new ModalServiceMock(), boardAdmin = new BoardAdmin(AuthServiceMock, new ModalServiceMock(),
new SettingsServiceMock(), new DragulaService()); new SettingsServiceMock(), new NotificationsServiceMock(),
new DragulaService());
}); });
it('has a function to get a color', () => { it('has a function to get a color', () => {

View File

@ -1,4 +1,4 @@
/* global expect AuthServiceMock NotificationsServiceMock UserSettingsServiceMock */ /* global expect AuthServiceMock NotificationsServiceMock SettingsServiceMock UserSettingsServiceMock */
var path = '../../../../build/settings/user-settings/', var path = '../../../../build/settings/user-settings/',
UserSettings = require(path + 'user-settings.component.js').UserSettings; UserSettings = require(path + 'user-settings.component.js').UserSettings;
@ -9,7 +9,8 @@ describe('UserSettings', () => {
beforeEach(() => { beforeEach(() => {
notifications = new NotificationsServiceMock(); notifications = new NotificationsServiceMock();
userSettings = new UserSettings(AuthServiceMock, userSettings = new UserSettings(AuthServiceMock,
notifications, UserSettingsServiceMock); notifications, new SettingsServiceMock(),
UserSettingsServiceMock);
}); });
it('resets forms on init', () => { it('resets forms on init', () => {