Test cleanup
This commit is contained in:
parent
1696e069a2
commit
6910627df5
@ -49,7 +49,9 @@ export class ApiInterceptor implements HttpInterceptor {
|
||||
sessionStorage.setItem(this.JWT_KEY, response.data[0]);
|
||||
}
|
||||
}, error => {
|
||||
if ((error.status === 401 || error.status === 400)) {
|
||||
/* istanbul ignore else */
|
||||
if ((error.status === 401 ||
|
||||
/* istanbul ignore next */ error.status === 400)) {
|
||||
sessionStorage.removeItem(this.JWT_KEY);
|
||||
this.router.navigate(['/']);
|
||||
}
|
||||
|
@ -157,6 +157,7 @@ export class UserAdminComponent {
|
||||
}
|
||||
|
||||
private closeModal(status: string): void {
|
||||
/* istanbul ignore else */
|
||||
if (status === 'success') {
|
||||
this.modal.close(this.MODAL_ID);
|
||||
this.saving = false;
|
||||
@ -171,6 +172,7 @@ export class UserAdminComponent {
|
||||
const boards = response.data[1];
|
||||
this.boards = [];
|
||||
|
||||
/* istanbul ignore else */
|
||||
if (boards) {
|
||||
boards.forEach((board: any) => {
|
||||
this.boards.push(new Board(+board.id, board.name,
|
||||
@ -194,6 +196,7 @@ export class UserAdminComponent {
|
||||
this.settings.getActions()
|
||||
.subscribe((response: ApiResponse) => {
|
||||
this.settings.updateActions(response.status === 'success'
|
||||
/* istanbul ignore next */
|
||||
? response.data[1]
|
||||
: []);
|
||||
this.loading = false;
|
||||
@ -217,6 +220,7 @@ export class UserAdminComponent {
|
||||
}
|
||||
|
||||
private replaceUserList(response: ApiResponse): void {
|
||||
/* istanbul ignore else */
|
||||
if (response.status === 'success') {
|
||||
this.users = [];
|
||||
|
||||
|
@ -13,6 +13,7 @@ export class ModalUser extends UserDisplay {
|
||||
public password_verify: string = ''; // tslint:disable-line
|
||||
public boardAccess: Array<string> = [];
|
||||
|
||||
/* istanbul ignore next */
|
||||
constructor(user: User) {
|
||||
super(+user.default_board_id, user.email, +user.id,
|
||||
user.last_login, +user.security_level, +user.user_option_id,
|
||||
|
@ -15,10 +15,6 @@ export class ContextMenuComponent {
|
||||
|
||||
const parentEl = el.nativeElement.parentElement;
|
||||
|
||||
if (!parentEl) {
|
||||
return;
|
||||
}
|
||||
|
||||
parentEl.oncontextmenu = (event: MouseEvent) => {
|
||||
this.parentEventHandler(event);
|
||||
|
||||
@ -31,13 +27,9 @@ export class ContextMenuComponent {
|
||||
private updatePosition(event: MouseEvent) {
|
||||
const edgeBuffer = 10;
|
||||
|
||||
// Adjust position if near an edge
|
||||
const target = this.el.nativeElement.firstElementChild;
|
||||
|
||||
if (!target) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Adjust position if near an edge
|
||||
const rect = target.getBoundingClientRect();
|
||||
const offsetX = (event.pageX + rect.width + edgeBuffer) > window.innerWidth;
|
||||
const offsetY = (event.pageY + rect.height + edgeBuffer) > window.innerHeight;
|
||||
|
@ -10,8 +10,8 @@ import {
|
||||
} from '@angular/common/http/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
||||
import { AuthService } from '../../src/app/shared/auth/auth.service';
|
||||
import { ApiInterceptor } from '../../src/app/app.api-http';
|
||||
import { AuthService } from 'src/app/shared/auth/auth.service';
|
||||
import { ApiInterceptor } from 'src/app/app.api-http';
|
||||
|
||||
describe('ApiInterceptor', () => {
|
||||
const mockAuthService = { };
|
||||
@ -75,6 +75,15 @@ describe('ApiInterceptor', () => {
|
||||
|
||||
req.flush({ data: ['newToken'] });
|
||||
expect(sessionStorage.getItem('taskboard.jwt')).toEqual('newToken');
|
||||
|
||||
sessionStorage.removeItem('taskboard.jwt');
|
||||
|
||||
http.post('', new FormData()).subscribe(response => {
|
||||
expect(response).toBeTruthy();
|
||||
});
|
||||
|
||||
const req2 = httpMock.expectOne(r => !r.headers.has('Authorization'));
|
||||
expect(req2.request.method).toEqual('POST');
|
||||
}
|
||||
)
|
||||
);
|
||||
@ -97,7 +106,7 @@ describe('ApiInterceptor', () => {
|
||||
expect(req.request.method).toEqual('GET');
|
||||
|
||||
const error = new HttpErrorResponse({ status: 401 });
|
||||
req.flush(error);
|
||||
req.flush(error, { status: 401, statusText: '' });
|
||||
expect(sessionStorage.getItem('Authorization')).toEqual(null);
|
||||
}
|
||||
)
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { TestBed, async } from '@angular/core/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
||||
import { AppComponent } from '../../src/app/app.component';
|
||||
import { AppComponent } from 'src/app/app.component';
|
||||
import {
|
||||
NotificationsService,
|
||||
StringsService
|
||||
} from '../../src/app/shared/services';
|
||||
import { SharedModule } from '../../src/app/shared/shared.module';
|
||||
} from 'src/app/shared/services';
|
||||
import { SharedModule } from 'src/app/shared/shared.module';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { AppModule } from '../../src/app/app.module';
|
||||
import { AppModule } from 'src/app/app.module';
|
||||
|
||||
describe('Module', () => {
|
||||
it('provides an AppModule class', () => {
|
||||
|
@ -15,15 +15,15 @@ import {
|
||||
Constants,
|
||||
ContextMenuService,
|
||||
NotificationsService
|
||||
} from '../../../src/app/shared/services';
|
||||
import { LoginComponent } from '../../../src/app/login/login.component';
|
||||
import { SettingsModule } from '../../../src/app/settings/settings.module';
|
||||
import { SharedModule } from '../../../src/app/shared/shared.module';
|
||||
import { DashboardModule } from '../../../src/app/dashboard/dashboard.module';
|
||||
import { BoardDisplayComponent } from '../../../src/app/board/board.component';
|
||||
import { BoardService } from '../../../src/app/board/board.service';
|
||||
import { ColumnDisplayComponent } from '../../../src/app/board/column/column.component';
|
||||
import { TaskDisplayComponent } from '../../../src/app/board/task/task.component';
|
||||
} from 'src/app/shared/services';
|
||||
import { LoginComponent } from 'src/app/login/login.component';
|
||||
import { SettingsModule } from 'src/app/settings/settings.module';
|
||||
import { SharedModule } from 'src/app/shared/shared.module';
|
||||
import { DashboardModule } from 'src/app/dashboard/dashboard.module';
|
||||
import { BoardDisplayComponent } from 'src/app/board/board.component';
|
||||
import { BoardService } from 'src/app/board/board.service';
|
||||
import { ColumnDisplayComponent } from 'src/app/board/column/column.component';
|
||||
import { TaskDisplayComponent } from 'src/app/board/task/task.component';
|
||||
import { RouterMock, BoardServiceMock } from '../mocks';
|
||||
|
||||
describe('BoardDisplay', () => {
|
||||
|
@ -4,17 +4,17 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
|
||||
import { ColumnDisplayComponent } from '../../../../src/app/board/column/column.component';
|
||||
import { TaskDisplayComponent } from '../../../../src/app/board/task/task.component';
|
||||
import { ColumnDisplayComponent } from 'src/app/board/column/column.component';
|
||||
import { TaskDisplayComponent } from 'src/app/board/task/task.component';
|
||||
import {
|
||||
AuthService,
|
||||
StringsService,
|
||||
ModalService,
|
||||
NotificationsService
|
||||
} from '../../../../src/app/shared/services';
|
||||
import { BoardService } from '../../../../src/app/board/board.service';
|
||||
import { SharedModule } from '../../../../src/app/shared/shared.module';
|
||||
import { User } from '../../../../src/app/shared/models';
|
||||
} from 'src/app/shared/services';
|
||||
import { BoardService } from 'src/app/board/board.service';
|
||||
import { SharedModule } from 'src/app/shared/shared.module';
|
||||
import { User } from 'src/app/shared/models';
|
||||
|
||||
describe('ColumnDisplay', () => {
|
||||
let component: ColumnDisplayComponent;
|
||||
|
@ -3,15 +3,15 @@ import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { TaskDisplayComponent } from '../../../../src/app/board/task/task.component';
|
||||
import { TaskDisplayComponent } from 'src/app/board/task/task.component';
|
||||
import {
|
||||
AuthService,
|
||||
StringsService,
|
||||
ModalService,
|
||||
NotificationsService
|
||||
} from '../../../../src/app/shared/services';
|
||||
import { BoardService } from '../../../../src/app/board/board.service';
|
||||
import { SharedModule } from '../../../../src/app/shared/shared.module';
|
||||
} from 'src/app/shared/services';
|
||||
import { BoardService } from 'src/app/board/board.service';
|
||||
import { SharedModule } from 'src/app/shared/shared.module';
|
||||
|
||||
describe('TaskDisplay', () => {
|
||||
let component: TaskDisplayComponent;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||
|
||||
import { CalendarComponent } from '../../../../src/app/dashboard/calendar/calendar.component';
|
||||
import { CalendarComponent } from 'src/app/dashboard/calendar/calendar.component';
|
||||
|
||||
describe('Calendar', () => {
|
||||
let component: CalendarComponent;
|
||||
|
@ -3,8 +3,8 @@ import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
|
||||
import { ChartsComponent } from '../../../../src/app/dashboard/charts/charts.component';
|
||||
import { DashboardModule } from '../../../../src/app/dashboard/dashboard.module';
|
||||
import { ChartsComponent } from 'src/app/dashboard/charts/charts.component';
|
||||
import { DashboardModule } from 'src/app/dashboard/dashboard.module';
|
||||
|
||||
describe('Charts', () => {
|
||||
let component: ChartsComponent;
|
||||
|
@ -3,8 +3,8 @@ import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
|
||||
import { DashboardComponent } from '../../../src/app/dashboard/dashboard.component';
|
||||
import { DashboardModule } from '../../../src/app/dashboard/dashboard.module';
|
||||
import { DashboardComponent } from 'src/app/dashboard/dashboard.component';
|
||||
import { DashboardModule } from 'src/app/dashboard/dashboard.module';
|
||||
|
||||
describe('DashBoard', () => {
|
||||
let component: DashboardComponent;
|
||||
|
@ -39,13 +39,22 @@ describe('FileViewer', () => {
|
||||
});
|
||||
|
||||
it('implements ngOnInit', () => {
|
||||
(component.service.getAttachmentInfo as any) = () => {
|
||||
return { subscribe: (fn: any) => fn({
|
||||
alerts: [{}],
|
||||
status: 'error'
|
||||
}) }
|
||||
};
|
||||
|
||||
component.ngOnInit();
|
||||
|
||||
(component.service.getAttachmentInfo as any) = () => {
|
||||
return { subscribe: (fn: any) => fn({
|
||||
alerts: [{}],
|
||||
data: [{}, { diskfilename: 'asdf' }],
|
||||
status: 'success'
|
||||
}) }
|
||||
}
|
||||
};
|
||||
|
||||
component.ngOnInit();
|
||||
|
||||
|
@ -3,13 +3,13 @@ import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { LoginComponent } from '../../../src/app/login/login.component';
|
||||
import { SharedModule } from '../../../src/app/shared/shared.module';
|
||||
import { LoginComponent } from 'src/app/login/login.component';
|
||||
import { SharedModule } from 'src/app/shared/shared.module';
|
||||
import {
|
||||
Constants,
|
||||
AuthService,
|
||||
NotificationsService
|
||||
} from '../../../src/app/shared/services';
|
||||
} from 'src/app/shared/services';
|
||||
|
||||
describe('Login', () => {
|
||||
let component: LoginComponent;
|
||||
|
@ -3,7 +3,7 @@ import { Location } from '@angular/common';
|
||||
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
import { User, Board } from '../../src/app/shared/models';
|
||||
import { User, Board } from 'src/app/shared/models';
|
||||
|
||||
export class RouterMock {
|
||||
public url = {
|
||||
|
@ -3,25 +3,21 @@ import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { SharedModule } from '../../../../src/app/shared/shared.module';
|
||||
|
||||
import {
|
||||
ActionTrigger,
|
||||
ActionType
|
||||
} from '../../../../src/app/shared/models';
|
||||
import { SharedModule } from 'src/app/shared/shared.module';
|
||||
import { ActionTrigger, ActionType } from 'src/app/shared/models';
|
||||
import {
|
||||
AuthService,
|
||||
ModalService,
|
||||
NotificationsService,
|
||||
StringsService
|
||||
} from '../../../../src/app/shared/services';
|
||||
import { SettingsService } from '../../../../src/app/settings/settings.service';
|
||||
} from 'src/app/shared/services';
|
||||
import { SettingsService } from 'src/app/settings/settings.service';
|
||||
import {
|
||||
AutoActionsService
|
||||
} from '../../../../src/app/settings/auto-actions/auto-actions.service';
|
||||
} from 'src/app/settings/auto-actions/auto-actions.service';
|
||||
import {
|
||||
AutoActionsComponent
|
||||
} from '../../../../src/app/settings/auto-actions/auto-actions.component';
|
||||
} from 'src/app/settings/auto-actions/auto-actions.component';
|
||||
|
||||
describe('AutoActions', () => {
|
||||
let component: AutoActionsComponent;
|
||||
|
@ -6,7 +6,7 @@ import {
|
||||
|
||||
import {
|
||||
AutoActionsService
|
||||
} from '../../../../src/app/settings/auto-actions/auto-actions.service';
|
||||
} from 'src/app/settings/auto-actions/auto-actions.service';
|
||||
|
||||
describe('AutoActionsService', () => {
|
||||
let injector: TestBed;
|
||||
|
@ -3,24 +3,24 @@ import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { SharedModule } from '../../../../src/app/shared/shared.module';
|
||||
import { SharedModule } from 'src/app/shared/shared.module';
|
||||
import { SettingsService } from 'src/app/settings/settings.service';
|
||||
import { Board } from 'src/app/shared/models';
|
||||
|
||||
import {
|
||||
AuthService,
|
||||
ModalService,
|
||||
NotificationsService,
|
||||
StringsService
|
||||
} from '../../../../src/app/shared/services';
|
||||
import { SettingsService } from '../../../../src/app/settings/settings.service';
|
||||
} from 'src/app/shared/services';
|
||||
import {
|
||||
BoardAdminService
|
||||
} from '../../../../src/app/settings/board-admin/board-admin.service';
|
||||
import { Board } from '../../../../src/app/shared/models';
|
||||
import { SettingsServiceMock, AuthServiceMock } from '../../mocks';
|
||||
|
||||
} from 'src/app/settings/board-admin/board-admin.service';
|
||||
import {
|
||||
BoardAdminComponent
|
||||
} from '../../../../src/app/settings/board-admin/board-admin.component';
|
||||
} from 'src/app/settings/board-admin/board-admin.component';
|
||||
|
||||
import { SettingsServiceMock, AuthServiceMock } from '../../mocks';
|
||||
|
||||
describe('BoardAdmin', () => {
|
||||
let component: BoardAdminComponent;
|
||||
|
@ -6,7 +6,7 @@ import {
|
||||
|
||||
import {
|
||||
BoardAdminService
|
||||
} from '../../../../src/app/settings/board-admin/board-admin.service';
|
||||
} from 'src/app/settings/board-admin/board-admin.service';
|
||||
|
||||
describe('BoardAdminService', () => {
|
||||
let injector: TestBed;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { BoardData } from '../../../../src/app/settings/board-admin/board-data.model';
|
||||
import { BoardData } from 'src/app/settings/board-admin/board-data.model';
|
||||
|
||||
describe('BoardData', () => {
|
||||
let model: BoardData;
|
||||
|
@ -4,10 +4,10 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
|
||||
import { SettingsComponent } from '../../../src/app/settings/settings.component';
|
||||
import { SettingsModule } from '../../../src/app/settings/settings.module';
|
||||
import { SettingsService } from '../../../src/app/settings/settings.service';
|
||||
import { StringsService } from '../../../src/app/shared/services';
|
||||
import { SettingsComponent } from 'src/app/settings/settings.component';
|
||||
import { SettingsModule } from 'src/app/settings/settings.module';
|
||||
import { SettingsService } from 'src/app/settings/settings.service';
|
||||
import { StringsService } from 'src/app/shared/services';
|
||||
|
||||
describe('Settings', () => {
|
||||
let component: SettingsComponent;
|
||||
|
@ -4,7 +4,7 @@ import {
|
||||
HttpTestingController
|
||||
} from '@angular/common/http/testing';
|
||||
|
||||
import { SettingsService } from '../../../src/app/settings/settings.service';
|
||||
import { SettingsService } from 'src/app/settings/settings.service';
|
||||
|
||||
describe('SettingsService', () => {
|
||||
let injector: TestBed;
|
||||
|
@ -3,27 +3,25 @@ import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { SharedModule } from '../../../../src/app/shared/shared.module';
|
||||
import { SharedModule } from 'src/app/shared/shared.module';
|
||||
import { SettingsService } from 'src/app/settings/settings.service';
|
||||
import { User } from 'src/app/shared/models';
|
||||
import { UserDisplay } from 'src/app/settings/user-admin/user-admin.models';
|
||||
|
||||
import {
|
||||
AuthService,
|
||||
ModalService,
|
||||
NotificationsService,
|
||||
StringsService
|
||||
} from '../../../../src/app/shared/services';
|
||||
import { SettingsService } from '../../../../src/app/settings/settings.service';
|
||||
} from 'src/app/shared/services';
|
||||
import {
|
||||
UserAdminService
|
||||
} from '../../../../src/app/settings/user-admin/user-admin.service';
|
||||
import { User } from '../../../../src/app/shared/models';
|
||||
import { SettingsServiceMock, AuthServiceMock } from '../../mocks';
|
||||
|
||||
import {
|
||||
UserDisplay
|
||||
} from '../../../../src/app/settings/user-admin/user-admin.models';
|
||||
} from 'src/app/settings/user-admin/user-admin.service';
|
||||
import {
|
||||
UserAdminComponent
|
||||
} from '../../../../src/app/settings/user-admin/user-admin.component';
|
||||
} from 'src/app/settings/user-admin/user-admin.component';
|
||||
|
||||
import { SettingsServiceMock, AuthServiceMock } from '../../mocks';
|
||||
|
||||
describe('UserAdmin', () => {
|
||||
let component: UserAdminComponent;
|
||||
@ -155,7 +153,7 @@ describe('UserAdmin', () => {
|
||||
let called = false;
|
||||
|
||||
(component.userService as any).addUser = () => {
|
||||
return { subscribe: fn => {
|
||||
return { subscribe: (fn: any) => {
|
||||
const user = new User();
|
||||
fn({ status: 'success', alerts: [{}], data: [{}, [user]] });
|
||||
called = true;
|
||||
|
@ -6,7 +6,7 @@ import {
|
||||
|
||||
import {
|
||||
UserAdminService
|
||||
} from '../../../../src/app/settings/user-admin/user-admin.service';
|
||||
} from 'src/app/settings/user-admin/user-admin.service';
|
||||
|
||||
describe('UserAdminService', () => {
|
||||
let injector: TestBed;
|
||||
|
@ -3,22 +3,21 @@ import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { SharedModule } from '../../../../src/app/shared/shared.module';
|
||||
|
||||
import { SharedModule } from 'src/app/shared/shared.module';
|
||||
import { SettingsService } from 'src/app/settings/settings.service';
|
||||
import {
|
||||
AuthService,
|
||||
NotificationsService,
|
||||
StringsService
|
||||
} from '../../../../src/app/shared/services';
|
||||
import { SettingsService } from '../../../../src/app/settings/settings.service';
|
||||
} from 'src/app/shared/services';
|
||||
import {
|
||||
UserSettingsService
|
||||
} from '../../../../src/app/settings/user-settings/user-settings.service';
|
||||
import { SettingsServiceMock, AuthServiceMock } from '../../mocks';
|
||||
|
||||
} from 'src/app/settings/user-settings/user-settings.service';
|
||||
import {
|
||||
UserSettingsComponent
|
||||
} from '../../../../src/app/settings/user-settings/user-settings.component';
|
||||
} from 'src/app/settings/user-settings/user-settings.component';
|
||||
|
||||
import { SettingsServiceMock, AuthServiceMock } from '../../mocks';
|
||||
|
||||
describe('UserSettings', () => {
|
||||
let component: UserSettingsComponent;
|
||||
@ -132,6 +131,18 @@ describe('UserSettings', () => {
|
||||
component.updatePassword();
|
||||
|
||||
expect(called).toEqual(true);
|
||||
|
||||
(component.users as any).changePassword = () => {
|
||||
return { subscribe: (fn: any) => {
|
||||
fn({ alerts: [], data: [{}, '{}'], status: 'success' });
|
||||
called = true;
|
||||
} };
|
||||
};
|
||||
|
||||
component.changePassword = { current: 'test', newPass: 'tester', verPass: 'tester' } as any;
|
||||
component.updatePassword();
|
||||
|
||||
expect(called).toEqual(true);
|
||||
});
|
||||
|
||||
it('calls a service to update a user\'s username', () => {
|
||||
|
@ -4,12 +4,12 @@ import {
|
||||
HttpTestingController
|
||||
} from '@angular/common/http/testing';
|
||||
|
||||
import { AuthService } from '../../../../src/app/shared/services';
|
||||
import { AuthServiceMock } from '../../mocks';
|
||||
|
||||
import { AuthService } from 'src/app/shared/services';
|
||||
import {
|
||||
UserSettingsService
|
||||
} from '../../../../src/app/settings/user-settings/user-settings.service';
|
||||
} from 'src/app/settings/user-settings/user-settings.service';
|
||||
|
||||
import { AuthServiceMock } from '../../mocks';
|
||||
|
||||
describe('UserSettingsService', () => {
|
||||
let injector: TestBed;
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { TestBed, getTestBed } from '@angular/core/testing'
|
||||
|
||||
import { AuthGuard } from '../../../../src/app/shared/auth/auth.guard';
|
||||
import { AuthService } from '../../../../src/app/shared/services';
|
||||
import { AuthGuard } from 'src/app/shared/auth/auth.guard';
|
||||
import { AuthService } from 'src/app/shared/services';
|
||||
|
||||
import { AuthServiceMock } from '../../mocks';
|
||||
|
||||
describe('AuthGuard', () => {
|
||||
|
@ -5,10 +5,9 @@ import {
|
||||
} from '@angular/common/http/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
||||
import { Constants } from '../../../../src/app/shared/constants';
|
||||
import { StringsService } from '../../../../src/app/shared/services';
|
||||
|
||||
import { AuthService } from '../../../../src/app/shared/auth/auth.service';
|
||||
import { Constants } from 'src/app/shared/constants';
|
||||
import { StringsService } from 'src/app/shared/services';
|
||||
import { AuthService } from 'src/app/shared/auth/auth.service';
|
||||
|
||||
describe('AuthService', () => {
|
||||
let injector: TestBed;
|
||||
@ -57,6 +56,12 @@ describe('AuthService', () => {
|
||||
});
|
||||
|
||||
testCall('api/authenticate', 'POST');
|
||||
|
||||
service.authenticate('', true).subscribe(response => {
|
||||
expect(response).toEqual(true);
|
||||
});
|
||||
|
||||
testCall('api/authenticate', 'POST');
|
||||
});
|
||||
|
||||
it('handles errors on authenticate', () => {
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Constants } from '../../../src/app/shared/constants';
|
||||
import { Constants } from 'src/app/shared/constants';
|
||||
|
||||
describe('Constants', () => {
|
||||
let constants;
|
||||
let constants: any;
|
||||
|
||||
beforeEach(() => {
|
||||
constants = new Constants();
|
||||
|
@ -3,7 +3,7 @@ import { Component, ViewChild } from '@angular/core';
|
||||
|
||||
import {
|
||||
ContextMenuItemComponent
|
||||
} from '../../../../src/app/shared/context-menu/context-menu-item.component';
|
||||
} from 'src/app/shared/context-menu/context-menu-item.component';
|
||||
|
||||
@Component({
|
||||
selector: 'tb-host-component',
|
||||
@ -51,6 +51,17 @@ describe('ContextMenuItem', () => {
|
||||
|
||||
expect(pdCalled).toEqual(true);
|
||||
expect(spCalled).toEqual(true);
|
||||
|
||||
pdCalled = false;
|
||||
spCalled = false;
|
||||
|
||||
hostComponent.menuItem.isSeparator = false;
|
||||
hostComponent.menuItem.isCustomEvent = false;
|
||||
|
||||
hostComponent.menuItem.el.nativeElement.onclick(evt);
|
||||
|
||||
expect(pdCalled).toEqual(false);
|
||||
expect(spCalled).toEqual(false);
|
||||
});
|
||||
|
||||
it('handles context menu clicks on the element', () => {
|
||||
|
@ -1,14 +1,13 @@
|
||||
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||
import { ElementRef } from '@angular/core';
|
||||
|
||||
import { SharedModule } from '../../../../src/app/shared/shared.module';
|
||||
|
||||
import { SharedModule } from 'src/app/shared/shared.module';
|
||||
import {
|
||||
ContextMenuService
|
||||
} from '../../../../src/app/shared/context-menu/context-menu.service';
|
||||
} from 'src/app/shared/context-menu/context-menu.service';
|
||||
import {
|
||||
ContextMenuComponent
|
||||
} from '../../../../src/app/shared/context-menu/context-menu.component';
|
||||
} from 'src/app/shared/context-menu/context-menu.component';
|
||||
|
||||
class ElementRefMock {
|
||||
public nativeElement = { parentElement: {} };
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {
|
||||
ContextMenuService
|
||||
} from '../../../../src/app/shared/context-menu/context-menu.service';
|
||||
} from 'src/app/shared/context-menu/context-menu.service';
|
||||
|
||||
describe('ContextMenuService', () => {
|
||||
let service: ContextMenuService;
|
||||
@ -14,7 +14,9 @@ describe('ContextMenuService', () => {
|
||||
});
|
||||
|
||||
it('can have a menu registered', () => {
|
||||
service.registerMenu(<any>{});
|
||||
const menu = {};
|
||||
service.registerMenu(menu as any);
|
||||
service.registerMenu(menu as any);
|
||||
|
||||
expect(service['menus'].length).toEqual(1);
|
||||
});
|
||||
|
@ -1,10 +1,9 @@
|
||||
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||
|
||||
import { SharedModule } from '../../../../src/app/shared/shared.module';
|
||||
|
||||
import { SharedModule } from 'src/app/shared/shared.module';
|
||||
import {
|
||||
InlineEditComponent
|
||||
} from '../../../../src/app/shared/inline-edit/inline-edit.component';
|
||||
} from 'src/app/shared/inline-edit/inline-edit.component';
|
||||
|
||||
describe('InlineEdit', () => {
|
||||
let component: InlineEditComponent;
|
||||
|
@ -3,10 +3,9 @@ import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { SharedModule } from '../../../../src/app/shared/shared.module';
|
||||
|
||||
import { ModalService } from '../../../../src/app/shared/services';
|
||||
import { ModalComponent } from '../../../../src/app/shared/modal/modal.component';
|
||||
import { SharedModule } from 'src/app/shared/shared.module';
|
||||
import { ModalService } from 'src/app/shared/services';
|
||||
import { ModalComponent } from 'src/app/shared/modal/modal.component';
|
||||
|
||||
describe('Modal', () => {
|
||||
let component: ModalComponent;
|
||||
|
@ -1,14 +1,10 @@
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { TestBed, getTestBed } from '@angular/core/testing'
|
||||
import {
|
||||
HttpClientTestingModule,
|
||||
HttpTestingController
|
||||
} from '@angular/common/http/testing';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
|
||||
import { SharedModule } from '../../../../src/app/shared/shared.module';
|
||||
import { AuthService } from '../../../../src/app/shared/services';
|
||||
|
||||
import { ModalService } from '../../../../src/app/shared/modal/modal.service';
|
||||
import { SharedModule } from 'src/app/shared/shared.module';
|
||||
import { AuthService } from 'src/app/shared/services';
|
||||
import { ModalService } from 'src/app/shared/modal/modal.service';
|
||||
|
||||
describe('ModalService', () => {
|
||||
let injector: TestBed;
|
||||
|
@ -13,7 +13,7 @@ import {
|
||||
Task,
|
||||
UserOptions,
|
||||
User
|
||||
} from '../../../../src/app/shared/models';
|
||||
} from 'src/app/shared/models';
|
||||
|
||||
describe('Models', () => {
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing';
|
||||
|
||||
import { SharedModule } from '../../../../src/app/shared/shared.module';
|
||||
import { NotificationsServiceMock } from '../../mocks';
|
||||
|
||||
import { SharedModule } from 'src/app/shared/shared.module';
|
||||
import {
|
||||
NotificationsService
|
||||
} from '../../../../src/app/shared/notifications/notifications.service';
|
||||
} from 'src/app/shared/notifications/notifications.service';
|
||||
import {
|
||||
NotificationsComponent
|
||||
} from '../../../../src/app/shared/notifications/notifications.component';
|
||||
} from 'src/app/shared/notifications/notifications.component';
|
||||
|
||||
import { NotificationsServiceMock } from '../../mocks';
|
||||
|
||||
describe('Notifications', () => {
|
||||
let component: NotificationsComponent;
|
||||
|
@ -5,9 +5,7 @@ import {
|
||||
} from '@angular/common/http/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
||||
import {
|
||||
StringsService
|
||||
} from '../../../../src/app/shared/strings/strings.service';
|
||||
import { StringsService } from 'src/app/shared/strings/strings.service';
|
||||
|
||||
describe('StringsService', () => {
|
||||
let injector: TestBed;
|
||||
|
@ -3,13 +3,13 @@ import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { TopNavComponent } from '../../../../src/app/shared/top-nav/top-nav.component';
|
||||
import { TopNavComponent } from 'src/app/shared/top-nav/top-nav.component';
|
||||
import {
|
||||
Constants,
|
||||
AuthService,
|
||||
NotificationsService,
|
||||
StringsService
|
||||
} from '../../../../src/app/shared/services';
|
||||
} from 'src/app/shared/services';
|
||||
|
||||
describe('TopNav', () => {
|
||||
let component: TopNavComponent;
|
||||
|
Reference in New Issue
Block a user