Update unit tests
This commit is contained in:
parent
16daaf8e5e
commit
d0958e0727
@ -746,6 +746,7 @@ export class ColumnDisplayComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
// Needs anonymous function for proper `this` context.
|
||||
// istanbul ignore next
|
||||
private markedCallback = (_: any, text: string) => {
|
||||
this.activeBoard.issue_trackers?.forEach(tracker => {
|
||||
const re = new RegExp(tracker.regex, 'ig');
|
||||
|
@ -12,7 +12,7 @@ describe('BoardService', () => {
|
||||
let httpMock: HttpTestingController;
|
||||
|
||||
const testCall = (url: string, method: string, isError = false) => {
|
||||
const req = httpMock.expectOne(url);
|
||||
const req = httpMock.expectOne('http://localhost:9876' + url);
|
||||
expect(req.request.method).toEqual(method);
|
||||
|
||||
if (isError) {
|
||||
@ -47,8 +47,12 @@ describe('BoardService', () => {
|
||||
service.activeBoardChanged.subscribe(() => (changed = true));
|
||||
|
||||
service.updateActiveBoard({} as any);
|
||||
|
||||
expect(changed).toEqual(true);
|
||||
|
||||
changed = false;
|
||||
|
||||
service.updateActiveBoard(null);
|
||||
expect(changed).toEqual(false);
|
||||
})
|
||||
|
||||
it('gets all boards', () => {
|
||||
|
@ -90,6 +90,11 @@ describe('ColumnDisplay', () => {
|
||||
const username = component.userName(1);
|
||||
|
||||
expect(username).toEqual('hi');
|
||||
|
||||
component.strings = { none: '' } as any;
|
||||
const noUser = component.userName(3);
|
||||
|
||||
expect(noUser).toEqual('');
|
||||
});
|
||||
|
||||
it('sorts tasks', () => {
|
||||
@ -111,6 +116,20 @@ describe('ColumnDisplay', () => {
|
||||
expect(component.columnData.tasks[0].points).toEqual(3);
|
||||
});
|
||||
|
||||
it('sorts comments', () => {
|
||||
(component.viewModalProps.comments as any[]) =
|
||||
[{ timestamp: 123 }, { timestamp: 12 }];
|
||||
|
||||
component.sortComments();
|
||||
|
||||
expect(component.viewModalProps.comments[0].timestamp).toEqual(12);
|
||||
|
||||
component.commentOrder = 'newest';
|
||||
component.sortComments();
|
||||
|
||||
expect(component.viewModalProps.comments[0].timestamp).toEqual(123);
|
||||
})
|
||||
|
||||
it('calls a service to toggle collapsed state', () => {
|
||||
(component.boardService.toggleCollapsed as any) = () => {
|
||||
return { subscribe: (fn: any) => fn({ data: [{}, [1]] } as any) };
|
||||
@ -561,7 +580,7 @@ describe('ColumnDisplay', () => {
|
||||
component.showActivity = true;
|
||||
component.columnData = { id: 1, tasks: [{
|
||||
id: 3, title: 'test', description: '', color: '#ffffe0', points: 1,
|
||||
position: 1, column_id: 1, comments: [], attachments: [],
|
||||
position: 1, column_id: 1, comments: [{ text: '' } as any], attachments: [],
|
||||
assignees: [{}], categories: [{}]
|
||||
}] } as any;
|
||||
|
||||
|
@ -12,7 +12,7 @@ describe('FileViewerService', () => {
|
||||
let httpMock: HttpTestingController;
|
||||
|
||||
const testCall = (url: string, method: string, isError = false) => {
|
||||
const req = httpMock.expectOne(url);
|
||||
const req = httpMock.expectOne('http://localhost:9876' + url);
|
||||
expect(req.request.method).toEqual(method);
|
||||
|
||||
if (isError) {
|
||||
|
@ -65,7 +65,7 @@ describe('AutoActionsService', () => {
|
||||
});
|
||||
|
||||
const testCall = (url: string, method: string, isError = false) => {
|
||||
const req = httpMock.expectOne(url);
|
||||
const req = httpMock.expectOne('http://localhost:9876' + url);
|
||||
expect(req.request.method).toEqual(method);
|
||||
|
||||
if (isError) {
|
||||
|
@ -81,7 +81,7 @@ describe('BoardAdminService', () => {
|
||||
});
|
||||
|
||||
const testCall = (url, method, isError = false) => {
|
||||
const req = httpMock.expectOne(url);
|
||||
const req = httpMock.expectOne('http://localhost:9876' + url);
|
||||
expect(req.request.method).toEqual(method);
|
||||
|
||||
if (isError) {
|
||||
|
@ -115,8 +115,8 @@ describe('SettingsService', () => {
|
||||
testCall('api/autoactions', 'GET', true);
|
||||
});
|
||||
|
||||
const testCall = (url, method, isError = false) => {
|
||||
const req = httpMock.expectOne(url);
|
||||
const testCall = (url: string, method: string, isError = false) => {
|
||||
const req = httpMock.expectOne('http://localhost:9876' + url);
|
||||
expect(req.request.method).toEqual(method);
|
||||
|
||||
if (isError) {
|
||||
|
@ -81,7 +81,7 @@ describe('UserAdminService', () => {
|
||||
});
|
||||
|
||||
const testCall = (url, method, isError = false) => {
|
||||
const req = httpMock.expectOne(url);
|
||||
const req = httpMock.expectOne('http://localhost:9876' + url);
|
||||
expect(req.request.method).toEqual(method);
|
||||
|
||||
if (isError) {
|
||||
|
@ -119,7 +119,7 @@ describe('UserSettingsService', () => {
|
||||
});
|
||||
|
||||
const testCall = (url, method, isError = false) => {
|
||||
const req = httpMock.expectOne(url);
|
||||
const req = httpMock.expectOne('http://localhost:9876' + url);
|
||||
expect(req.request.method).toEqual(method);
|
||||
|
||||
if (isError) {
|
||||
|
@ -97,7 +97,7 @@ describe('AuthService', () => {
|
||||
});
|
||||
|
||||
const testCall = (url: string, method: string, isError = false) => {
|
||||
const req = httpMock.expectOne({ method, url });
|
||||
const req = httpMock.expectOne('/' + url);
|
||||
expect(req.request.method).toEqual(method);
|
||||
|
||||
if (isError) {
|
||||
|
@ -8,7 +8,7 @@ describe('Constants', () => {
|
||||
});
|
||||
|
||||
it('has a VERSION', () => {
|
||||
expect(constants.VERSION).toEqual('1.0.0');
|
||||
expect(constants.VERSION).toEqual('1.0.1');
|
||||
});
|
||||
|
||||
it('has a TOKEN', () => {
|
||||
|
Reference in New Issue
Block a user