Update tests to fail build and fix failing tests
This commit is contained in:
parent
169ab817fb
commit
7ee796149d
@ -13,7 +13,7 @@ before_script:
|
|||||||
- chmod a+w tests.db
|
- chmod a+w tests.db
|
||||||
script:
|
script:
|
||||||
- ./src/api/vendor/phpunit/phpunit/phpunit -c test/api/phpunit.xml
|
- ./src/api/vendor/phpunit/phpunit/phpunit -c test/api/phpunit.xml
|
||||||
- gulp coverage
|
- gulp test-app && gulp coverage
|
||||||
after_success:
|
after_success:
|
||||||
- echo -e "<?php\n print phpversion();" > version.php
|
- echo -e "<?php\n print phpversion();" > version.php
|
||||||
- curl "https://raw.githubusercontent.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh" -o dropbox_uploader.sh
|
- curl "https://raw.githubusercontent.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh" -o dropbox_uploader.sh
|
||||||
|
@ -2,7 +2,78 @@
|
|||||||
|
|
||||||
var MockBrowser = require('mock-browser').mocks.MockBrowser,
|
var MockBrowser = require('mock-browser').mocks.MockBrowser,
|
||||||
mockBrowser = new MockBrowser(),
|
mockBrowser = new MockBrowser(),
|
||||||
chai = require('chai');
|
chai = require('chai'),
|
||||||
|
users = [
|
||||||
|
{
|
||||||
|
id: '1',
|
||||||
|
default_board_id: '0',
|
||||||
|
username: 'tester',
|
||||||
|
security_level: '2',
|
||||||
|
user_option_id: '0',
|
||||||
|
board_access: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '2',
|
||||||
|
default_board_id: '0',
|
||||||
|
username: 'test',
|
||||||
|
security_level: '3',
|
||||||
|
user_option_id: '0',
|
||||||
|
board_access: []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
boards = [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: 'testing',
|
||||||
|
is_active: true,
|
||||||
|
columns: [{
|
||||||
|
id: 1,
|
||||||
|
name: 'Column 1',
|
||||||
|
position: 0,
|
||||||
|
board_id: 1,
|
||||||
|
tasks: []
|
||||||
|
}],
|
||||||
|
categories: [{
|
||||||
|
id: 1,
|
||||||
|
name: 'Category 1'
|
||||||
|
}],
|
||||||
|
issue_trackers: [],
|
||||||
|
users: [ users[1] ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
name: 'test',
|
||||||
|
is_active: false,
|
||||||
|
columns: [{
|
||||||
|
id: 2,
|
||||||
|
name: 'Column 1',
|
||||||
|
position: 0,
|
||||||
|
board_id: 2,
|
||||||
|
tasks: []
|
||||||
|
}],
|
||||||
|
categories: [],
|
||||||
|
issue_trackers: [],
|
||||||
|
users
|
||||||
|
}
|
||||||
|
],
|
||||||
|
actions = [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
trigger: 1,
|
||||||
|
source_id: 1,
|
||||||
|
type: 1,
|
||||||
|
change_to: 'test',
|
||||||
|
board_id: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
trigger: 2,
|
||||||
|
source_id: 2,
|
||||||
|
type: 2,
|
||||||
|
change_to: 'testing',
|
||||||
|
board_id: 2
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
global.window = mockBrowser.getWindow();
|
global.window = mockBrowser.getWindow();
|
||||||
global.document = mockBrowser.getDocument();
|
global.document = mockBrowser.getDocument();
|
||||||
@ -57,12 +128,7 @@ global.AuthServiceMock = {
|
|||||||
userOptions: {
|
userOptions: {
|
||||||
show_animations: false
|
show_animations: false
|
||||||
},
|
},
|
||||||
userChanged: RxJs.Observable.of({
|
userChanged: RxJs.Observable.of(users[0]),
|
||||||
id: 1,
|
|
||||||
username: 'tester',
|
|
||||||
default_board_id: 0,
|
|
||||||
security_level: 2
|
|
||||||
}),
|
|
||||||
updateUser: user => {
|
updateUser: user => {
|
||||||
},
|
},
|
||||||
login: () => {
|
login: () => {
|
||||||
@ -127,85 +193,15 @@ global.ModalServiceMock = function() {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
var users = [
|
|
||||||
{
|
|
||||||
id: '1',
|
|
||||||
default_board_id: '0',
|
|
||||||
username: 'tester',
|
|
||||||
security_level: '2',
|
|
||||||
user_option_id: '0',
|
|
||||||
board_access: []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '2',
|
|
||||||
default_board_id: '0',
|
|
||||||
username: 'test',
|
|
||||||
security_level: '3',
|
|
||||||
user_option_id: '0',
|
|
||||||
board_access: []
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
var boards = [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: 'testing',
|
|
||||||
is_active: true,
|
|
||||||
columns: [{
|
|
||||||
id: 1,
|
|
||||||
name: 'Column 1',
|
|
||||||
position: 0,
|
|
||||||
board_id: 1,
|
|
||||||
tasks: []
|
|
||||||
}],
|
|
||||||
categories: [{
|
|
||||||
id: 1,
|
|
||||||
name: 'Category 1'
|
|
||||||
}],
|
|
||||||
issue_trackers: [],
|
|
||||||
users: [ users[1] ]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: 'test',
|
|
||||||
is_active: false,
|
|
||||||
columns: [{
|
|
||||||
id: 2,
|
|
||||||
name: 'Column 1',
|
|
||||||
position: 0,
|
|
||||||
board_id: 2,
|
|
||||||
tasks: []
|
|
||||||
}],
|
|
||||||
categories: [],
|
|
||||||
issue_trackers: [],
|
|
||||||
users
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
var actions = [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
trigger: 1,
|
|
||||||
source_id: 1,
|
|
||||||
type: 1,
|
|
||||||
change_to: 'test',
|
|
||||||
board_id: 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
trigger: 2,
|
|
||||||
source_id: 2,
|
|
||||||
type: 2,
|
|
||||||
change_to: 'testing',
|
|
||||||
board_id: 2
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
global.StringsServiceMock = {
|
global.StringsServiceMock = {
|
||||||
stringsChanged: {
|
stringsChanged: {
|
||||||
subscribe: function() {}
|
subscribe(callback) {
|
||||||
|
callback({
|
||||||
|
settings: 'Settings'
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
loadStrings: function() {}
|
loadStrings() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
global.SettingsServiceMock = function() {
|
global.SettingsServiceMock = function() {
|
||||||
@ -254,6 +250,8 @@ global.SettingsServiceMock = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
global.UserAdminServiceMock = function() {
|
global.UserAdminServiceMock = function() {
|
||||||
|
var userList = users.slice();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
addUser: user => {
|
addUser: user => {
|
||||||
return RxJs.Observable.of({
|
return RxJs.Observable.of({
|
||||||
@ -261,7 +259,7 @@ global.UserAdminServiceMock = function() {
|
|||||||
alerts: [],
|
alerts: [],
|
||||||
data: [
|
data: [
|
||||||
null,
|
null,
|
||||||
users.concat(user)
|
userList.concat(user)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -271,8 +269,8 @@ global.UserAdminServiceMock = function() {
|
|||||||
alerts: [],
|
alerts: [],
|
||||||
data: [
|
data: [
|
||||||
null,
|
null,
|
||||||
JSON.stringify(users[1]),
|
JSON.stringify(userList[1]),
|
||||||
users
|
userList
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -282,7 +280,7 @@ global.UserAdminServiceMock = function() {
|
|||||||
alerts: [],
|
alerts: [],
|
||||||
data: [
|
data: [
|
||||||
null,
|
null,
|
||||||
users.slice(1)
|
userList.slice(1)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* global expect AuthServiceMock SettingsServiceMock BoardAdminServiceMock
|
/* global expect AuthServiceMock SettingsServiceMock BoardAdminServiceMock
|
||||||
ModalServiceMock NotificationsServiceMock */
|
ModalServiceMock NotificationsServiceMock StringsServiceMock */
|
||||||
var dirs = '../../../../',
|
var dirs = '../../../../',
|
||||||
path = dirs + 'build/settings/board-admin/',
|
path = dirs + 'build/settings/board-admin/',
|
||||||
pathDrag = dirs + 'node_modules/ng2-dragula/components/',
|
pathDrag = dirs + 'node_modules/ng2-dragula/components/',
|
||||||
@ -15,7 +15,8 @@ describe('BoardAdmin', () => {
|
|||||||
|
|
||||||
boardAdmin = new BoardAdmin(AuthServiceMock, modalService,
|
boardAdmin = new BoardAdmin(AuthServiceMock, modalService,
|
||||||
new SettingsServiceMock(), new BoardAdminServiceMock(),
|
new SettingsServiceMock(), new BoardAdminServiceMock(),
|
||||||
new NotificationsServiceMock(), new DragulaService());
|
new NotificationsServiceMock(), StringsServiceMock,
|
||||||
|
new DragulaService());
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has a function to get a color', () => {
|
it('has a function to get a color', () => {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* global expect TitleMock */
|
/* global expect TitleMock StringsServiceMock */
|
||||||
var path = '../../../build/settings/',
|
var path = '../../../build/settings/',
|
||||||
Settings = require(path + 'settings.component.js').Settings;
|
Settings = require(path + 'settings.component.js').Settings;
|
||||||
|
|
||||||
@ -8,7 +8,7 @@ describe('Settings', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
title = new TitleMock();
|
title = new TitleMock();
|
||||||
// Just need to create Settings to set Title
|
// Just need to create Settings to set Title
|
||||||
var settings = new Settings(null, title);
|
var settings = new Settings(null, StringsServiceMock, title);
|
||||||
settings;
|
settings;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ describe('UserAdmin', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('has a function to add or edit a user - Add', done => {
|
it('has a function to add or edit a user - Add', done => {
|
||||||
userAdmin.modalProps.title = 'Add';
|
userAdmin.modalProps.prefix = true;
|
||||||
userAdmin.modalProps.user = newUser;
|
userAdmin.modalProps.user = newUser;
|
||||||
|
|
||||||
userAdmin.addEditUser();
|
userAdmin.addEditUser();
|
||||||
@ -38,8 +38,9 @@ describe('UserAdmin', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('has a function to add or edit a user - Edit', done => {
|
it('has a function to add or edit a user - Edit', done => {
|
||||||
userAdmin.modalProps.title = 'Edit';
|
userAdmin.modalProps.prefix = false;
|
||||||
userAdmin.modalProps.user = newUser;
|
userAdmin.modalProps.user = newUser;
|
||||||
|
userAdmin.modalProps.user.id = 2;
|
||||||
|
|
||||||
userAdmin.addEditUser();
|
userAdmin.addEditUser();
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* global expect ConstantsMock RouterMock AuthServiceMock NotificationsServiceMock */
|
/* global expect ConstantsMock RouterMock AuthServiceMock NotificationsServiceMock StringsServiceMock */
|
||||||
var path = '../../../../build/shared/top-nav/',
|
var path = '../../../../build/shared/top-nav/',
|
||||||
TopNav = require(path + 'top-nav.component.js').TopNav;
|
TopNav = require(path + 'top-nav.component.js').TopNav;
|
||||||
|
|
||||||
@ -9,7 +9,8 @@ describe('TopNav', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
router = new RouterMock();
|
router = new RouterMock();
|
||||||
topNav = new TopNav(ConstantsMock, router,
|
topNav = new TopNav(ConstantsMock, router,
|
||||||
AuthServiceMock, new NotificationsServiceMock());
|
AuthServiceMock, new NotificationsServiceMock(),
|
||||||
|
StringsServiceMock);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has pageName', () => {
|
it('has pageName', () => {
|
||||||
|
Reference in New Issue
Block a user