-
Notifications
You must be signed in to change notification settings - Fork 268
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Grzegorz Jaskowski <[email protected]>
- Loading branch information
1 parent
a7e7934
commit d61c20c
Showing
6 changed files
with
20 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,8 +20,6 @@ import { fakeAppFilter } from './task-filters.mock'; | |
|
||
export const fakeUser1 = { id: 1, email: '[email protected]', firstName: 'firstName', lastName: 'lastName' }; | ||
|
||
export const fakeUser2 = { id: 1001, email: '[email protected]', firstName: 'some', lastName: 'one' }; | ||
|
||
export const fakeTaskList = new TaskListModel({ | ||
size: 1, | ||
total: 1, | ||
|
@@ -37,151 +35,4 @@ export const fakeTaskList = new TaskListModel({ | |
} | ||
] | ||
}); | ||
|
||
export const secondFakeTaskList = { | ||
size: 1, | ||
total: 1, | ||
start: 0, | ||
data: [ | ||
{ | ||
id: '200', | ||
name: 'FakeNameTask', | ||
description: null, | ||
category: null, | ||
assignee: fakeUser1, | ||
created: '2016-07-15T11:19:17.440+0000' | ||
} | ||
] | ||
}; | ||
|
||
export const fakeTaskDetails = { id: '999', name: 'fake-task-name', formKey: '99', assignee: fakeUser1 }; | ||
|
||
export const fakeTasksChecklist = { | ||
size: 1, | ||
total: 1, | ||
start: 0, | ||
data: [ | ||
{ | ||
id: 1, | ||
name: 'FakeCheckTask1', | ||
description: null, | ||
category: null, | ||
assignee: fakeUser1, | ||
created: '2016-07-15T11:19:17.440+0000' | ||
}, | ||
{ | ||
id: 2, | ||
name: 'FakeCheckTask2', | ||
description: null, | ||
category: null, | ||
assignee: fakeUser1, | ||
created: '2016-07-15T11:19:17.440+0000' | ||
} | ||
] | ||
}; | ||
|
||
export const fakeAppPromise = Promise.resolve(fakeAppFilter); | ||
|
||
export const fakeFormList = { | ||
size: 2, | ||
total: 2, | ||
start: 0, | ||
data: [ | ||
{ | ||
id: 1, | ||
name: 'form with all widgets', | ||
description: '', | ||
createdBy: 2, | ||
createdByFullName: 'Admin Admin', | ||
lastUpdatedBy: 2, | ||
lastUpdatedByFullName: 'Admin Admin', | ||
lastUpdated: 1491400951205, | ||
latestVersion: true, | ||
version: 4, | ||
comment: null, | ||
stencilSet: null, | ||
referenceId: null, | ||
modelType: 2, | ||
favorite: null, | ||
permission: 'write', | ||
tenantId: null | ||
}, | ||
{ | ||
id: 2, | ||
name: 'uppy', | ||
description: '', | ||
createdBy: 2, | ||
createdByFullName: 'Admin Admin', | ||
lastUpdatedBy: 2, | ||
lastUpdatedByFullName: 'Admin Admin', | ||
lastUpdated: 1490951054477, | ||
latestVersion: true, | ||
version: 2, | ||
comment: null, | ||
stencilSet: null, | ||
referenceId: null, | ||
modelType: 2, | ||
favorite: null, | ||
permission: 'write', | ||
tenantId: null | ||
} | ||
] | ||
}; | ||
|
||
export const fakeTaskOpen1 = { | ||
id: '1', | ||
name: 'FakeOpenTask1', | ||
description: null, | ||
category: null, | ||
assignee: fakeUser1, | ||
created: '2017-07-15T11:19:17.440+0000', | ||
dueDate: null, | ||
endDate: null | ||
}; | ||
|
||
export const fakeTaskOpen2 = { | ||
id: '1', | ||
name: 'FakeOpenTask2', | ||
description: null, | ||
category: null, | ||
assignee: { id: 1, email: '[email protected]', firstName: 'firstName', lastName: 'lastName' }, | ||
created: '2017-07-15T11:19:17.440+0000', | ||
dueDate: null, | ||
endDate: null | ||
}; | ||
|
||
export const fakeTaskCompleted1 = { | ||
id: '1', | ||
name: 'FakeCompletedTaskName1', | ||
description: null, | ||
category: null, | ||
assignee: { id: 1, email: '[email protected]', firstName: 'firstName', lastName: 'lastName' }, | ||
created: '2016-07-15T11:19:17.440+0000', | ||
dueDate: null, | ||
endDate: '2016-11-03T15:25:42.749+0000' | ||
}; | ||
|
||
export const fakeTaskCompleted2 = { | ||
id: '1', | ||
name: 'FakeCompletedTaskName2', | ||
description: null, | ||
category: null, | ||
assignee: fakeUser1, | ||
created: null, | ||
dueDate: null, | ||
endDate: '2016-11-03T15:25:42.749+0000' | ||
}; | ||
|
||
export const fakeOpenTaskList = new TaskListModel({ | ||
size: 2, | ||
total: 2, | ||
start: 0, | ||
data: [fakeTaskOpen1, fakeTaskOpen2] | ||
}); | ||
|
||
export const fakeCompletedTaskList = new TaskListModel({ | ||
size: 2, | ||
total: 2, | ||
start: 0, | ||
data: [fakeTaskCompleted1, fakeTaskCompleted2] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,10 +18,10 @@ | |
import { TestBed } from '@angular/core/testing'; | ||
import { CoreModule } from '@alfresco/adf-core'; | ||
import { of } from 'rxjs'; | ||
import { fakeCompletedTaskList, fakeOpenTaskList, fakeTaskList } from '../../mock'; | ||
import { fakeFilter } from '../../mock/task/task-filters.mock'; | ||
import { fakeFilter, mockFilterNoState } from '../../mock/task/task-filters.mock'; | ||
import { TaskListService } from './tasklist.service'; | ||
import { ProcessTestingModule } from '../../testing/process.testing.module'; | ||
import { fakeTaskList } from '../../mock'; | ||
|
||
describe('Activiti TaskList Service', () => { | ||
let service: TaskListService; | ||
|
@@ -38,7 +38,7 @@ describe('Activiti TaskList Service', () => { | |
spyOn(service, 'getTasks').and.returnValue(of(fakeTaskList)); | ||
spyOn(service, 'getTotalTasks').and.returnValue(of(fakeTaskList)); | ||
|
||
service.findAllTaskByState(fakeFilter, 'open').subscribe((res) => { | ||
service.findAllTasksByState(fakeFilter, 'open').subscribe((res) => { | ||
expect(res).toBeDefined(); | ||
expect(res.size).toEqual(1); | ||
expect(res.start).toEqual(0); | ||
|
@@ -56,7 +56,7 @@ describe('Activiti TaskList Service', () => { | |
spyOn(service, 'getTasks').and.returnValue(of(fakeTaskList)); | ||
spyOn(service, 'getTotalTasks').and.returnValue(of(fakeTaskList)); | ||
|
||
service.findAllTaskByState(fakeFilter).subscribe((res) => { | ||
service.findAllTasksByState(fakeFilter).subscribe((res) => { | ||
expect(res).toBeDefined(); | ||
expect(res.size).toEqual(1); | ||
expect(res.start).toEqual(0); | ||
|
@@ -74,51 +74,11 @@ describe('Activiti TaskList Service', () => { | |
spyOn(service, 'getTasks').and.returnValue(of(fakeTaskList)); | ||
spyOn(service, 'getTotalTasks').and.returnValue(of(fakeTaskList)); | ||
|
||
service.findAllTasksWithoutState(fakeFilter).subscribe((res) => { | ||
service.findAllTasksByState(mockFilterNoState).subscribe((res) => { | ||
expect(res).toBeDefined(); | ||
expect(res.data).toBeDefined(); | ||
expect(res.data.length).toEqual(2); | ||
expect(res.data[0].name).toEqual('FakeNameTask'); | ||
expect(res.data[0].assignee.email).toEqual('[email protected]'); | ||
expect(res.data[0].assignee.firstName).toEqual('firstName'); | ||
expect(res.data[0].assignee.lastName).toEqual('lastName'); | ||
|
||
expect(res.data[1].name).toEqual('FakeNameTask'); | ||
expect(res.data[1].assignee.email).toEqual('[email protected]'); | ||
expect(res.data[1].assignee.firstName).toEqual('firstName'); | ||
expect(res.data[1].assignee.lastName).toEqual('lastName'); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('Should return both open and completed task', (done) => { | ||
spyOn(service, 'findTasksByState').and.returnValue(of(fakeOpenTaskList)); | ||
spyOn(service, 'findAllTaskByState').and.returnValue(of(fakeCompletedTaskList)); | ||
service.findAllTasksWithoutState(fakeFilter).subscribe((res) => { | ||
expect(res).toBeDefined(); | ||
expect(res.data).toBeDefined(); | ||
expect(res.data.length).toEqual(4); | ||
expect(res.data[0].name).toEqual('FakeOpenTask1'); | ||
expect(res.data[1].assignee.email).toEqual('[email protected]'); | ||
expect(res.data[2].name).toEqual('FakeCompletedTaskName1'); | ||
expect(res.data[2].assignee.email).toEqual('[email protected]'); | ||
expect(res.data[3].name).toEqual('FakeCompletedTaskName2'); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should add the task list to the tasklistSubject with all tasks filtered without state', (done) => { | ||
spyOn(service, 'getTasks').and.returnValue(of(fakeTaskList)); | ||
spyOn(service, 'getTotalTasks').and.returnValue(of(fakeTaskList)); | ||
|
||
service.findAllTasksWithoutState(fakeFilter).subscribe((res) => { | ||
expect(res).toBeDefined(); | ||
expect(res.data).toBeDefined(); | ||
expect(res.data.length).toEqual(2); | ||
expect(res.data.length).toEqual(1); | ||
expect(res.data[0].name).toEqual('FakeNameTask'); | ||
expect(res.data[0].assignee.email).toEqual('[email protected]'); | ||
expect(res.data[1].name).toEqual('FakeNameTask'); | ||
expect(res.data[1].assignee.email).toEqual('[email protected]'); | ||
done(); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters