Compare commits

...

2 Commits

Author SHA1 Message Date
Ivan
429de1eaed test(pipeline-tasks): pass test cases. 2021-03-27 15:52:21 +08:00
Ivan
08e5c7e7d3 refactor(pipeline-tasks): remove unused queue. 2021-03-27 15:34:08 +08:00
2 changed files with 7 additions and 6 deletions

View File

@ -19,12 +19,9 @@ import { PubSub } from 'apollo-server-express';
@Module({
imports: [
TypeOrmModule.forFeature([PipelineTask, Pipeline]),
BullModule.registerQueue(
{
name: PIPELINE_TASK_QUEUE,
},
{ name: PIPELINE_TASK_LOG_QUEUE },
),
BullModule.registerQueue({
name: PIPELINE_TASK_QUEUE,
}),
RedisModule,
ReposModule,
],

View File

@ -32,6 +32,7 @@ describe('PipelineTasksService', () => {
({
pipelineId: 'test',
commit: 'test',
pipeline: { branch: 'master' },
units: [],
} as PipelineTask);
@ -79,6 +80,7 @@ describe('PipelineTasksService', () => {
jest
.spyOn(taskRepository, 'create')
.mockImplementation((data: any) => data);
jest.spyOn(taskRepository, 'findOne').mockImplementation(async () => null);
});
it('should be defined', () => {
@ -103,6 +105,7 @@ describe('PipelineTasksService', () => {
const save = jest
.spyOn(taskRepository, 'save')
.mockImplementation(async (data: any) => data);
const findOne = jest.spyOn(taskRepository, 'findOne');
jest
.spyOn(service, 'doNextTask')
.mockImplementation(async () => undefined);
@ -112,6 +115,7 @@ describe('PipelineTasksService', () => {
commit: 'test',
units: [],
});
expect(findOne).toBeCalled();
});
it('add task', async () => {
const lpush = jest.spyOn(redisClient, 'lpush');