diff --git a/src/test-runs/test-runs.controller.ts b/src/test-runs/test-runs.controller.ts index fc5e7f50..e89a9954 100644 --- a/src/test-runs/test-runs.controller.ts +++ b/src/test-runs/test-runs.controller.ts @@ -21,7 +21,7 @@ import { CommentDto } from '../shared/dto/comment.dto'; import { TestRunResultDto } from './dto/testRunResult.dto'; import { ApiGuard } from '../auth/guards/api.guard'; import { CreateTestRequestDto } from './dto/create-test-request.dto'; -import { PaginatedTestRunDto } from './dto/testRun-paginated.dto'; +import { TestRunDto } from './dto/testRun.dto'; @ApiTags('test-runs') @Controller('test-runs') @@ -29,15 +29,11 @@ export class TestRunsController { constructor(private testRunsService: TestRunsService) {} @Get() - @ApiOkResponse({ type: PaginatedTestRunDto }) + @ApiOkResponse({ type: [TestRunDto] }) @ApiBearerAuth() @UseGuards(JwtAuthGuard) - get( - @Query('buildId', new ParseUUIDPipe()) buildId: string, - @Query('take', new ParseIntPipe()) take: number, - @Query('skip', new ParseIntPipe()) skip: number - ): Promise { - return this.testRunsService.findMany(buildId, take, skip); + get(@Query('buildId', new ParseUUIDPipe()) buildId: string): Promise { + return this.testRunsService.findMany(buildId); } @Get('recalculateDiff/:id') diff --git a/src/test-runs/test-runs.service.spec.ts b/src/test-runs/test-runs.service.spec.ts index 597a6b17..41ca7970 100644 --- a/src/test-runs/test-runs.service.spec.ts +++ b/src/test-runs/test-runs.service.spec.ts @@ -843,28 +843,16 @@ describe('TestRunsService', () => { merge: false, }; const testRunFindManyMock = jest.fn().mockResolvedValueOnce([testRun]); - const testRunCountMock = jest.fn().mockResolvedValueOnce(30); service = await initService({ testRunFindManyMock, - testRunCountMock, }); - const result = await service.findMany(buildId, 10, 1); + const result = await service.findMany(buildId); expect(testRunFindManyMock).toHaveBeenCalledWith({ where: { buildId }, - take: 10, - skip: 1, - }); - expect(testRunCountMock).toHaveBeenCalledWith({ - where: { buildId }, - }); - expect(result).toEqual({ - data: [new TestRunDto(testRun)], - take: 10, - skip: 1, - total: 30, }); + expect(result).toEqual([new TestRunDto(testRun)]); }); it('delete', async () => { diff --git a/src/test-runs/test-runs.service.ts b/src/test-runs/test-runs.service.ts index dad02035..1d13970f 100644 --- a/src/test-runs/test-runs.service.ts +++ b/src/test-runs/test-runs.service.ts @@ -28,21 +28,11 @@ export class TestRunsService { private eventsGateway: EventsGateway ) {} - async findMany(buildId: string, take: number, skip: number): Promise { - const [total, list] = await Promise.all([ - this.prismaService.testRun.count({ where: { buildId } }), - this.prismaService.testRun.findMany({ - where: { buildId }, - take, - skip, - }), - ]); - return { - data: list.map((item) => new TestRunDto(item)), - total, - take, - skip, - }; + async findMany(buildId: string): Promise { + const list = await this.prismaService.testRun.findMany({ + where: { buildId }, + }); + return list.map((item) => new TestRunDto(item)); } async findOne(