test(pipeline-tasks): pass test cases.
This commit is contained in:
parent
08e5c7e7d3
commit
429de1eaed
@ -32,6 +32,7 @@ describe('PipelineTasksService', () => {
|
|||||||
({
|
({
|
||||||
pipelineId: 'test',
|
pipelineId: 'test',
|
||||||
commit: 'test',
|
commit: 'test',
|
||||||
|
pipeline: { branch: 'master' },
|
||||||
units: [],
|
units: [],
|
||||||
} as PipelineTask);
|
} as PipelineTask);
|
||||||
|
|
||||||
@ -79,6 +80,7 @@ describe('PipelineTasksService', () => {
|
|||||||
jest
|
jest
|
||||||
.spyOn(taskRepository, 'create')
|
.spyOn(taskRepository, 'create')
|
||||||
.mockImplementation((data: any) => data);
|
.mockImplementation((data: any) => data);
|
||||||
|
jest.spyOn(taskRepository, 'findOne').mockImplementation(async () => null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be defined', () => {
|
it('should be defined', () => {
|
||||||
@ -103,6 +105,7 @@ describe('PipelineTasksService', () => {
|
|||||||
const save = jest
|
const save = jest
|
||||||
.spyOn(taskRepository, 'save')
|
.spyOn(taskRepository, 'save')
|
||||||
.mockImplementation(async (data: any) => data);
|
.mockImplementation(async (data: any) => data);
|
||||||
|
const findOne = jest.spyOn(taskRepository, 'findOne');
|
||||||
jest
|
jest
|
||||||
.spyOn(service, 'doNextTask')
|
.spyOn(service, 'doNextTask')
|
||||||
.mockImplementation(async () => undefined);
|
.mockImplementation(async () => undefined);
|
||||||
@ -112,6 +115,7 @@ describe('PipelineTasksService', () => {
|
|||||||
commit: 'test',
|
commit: 'test',
|
||||||
units: [],
|
units: [],
|
||||||
});
|
});
|
||||||
|
expect(findOne).toBeCalled();
|
||||||
});
|
});
|
||||||
it('add task', async () => {
|
it('add task', async () => {
|
||||||
const lpush = jest.spyOn(redisClient, 'lpush');
|
const lpush = jest.spyOn(redisClient, 'lpush');
|
||||||
|
Loading…
Reference in New Issue
Block a user