Skip to content

Commit

Permalink
Fixed source e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pepermao committed Jul 5, 2024
1 parent 4c31c55 commit 8c87b90
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions server/source/dto/create-source.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,9 @@ export class CreateSourceDTO {
@IsString()
@ApiProperty()
recaptcha: string;

@IsString()
@IsOptional()
@ApiProperty()
targetId: string;
}
7 changes: 5 additions & 2 deletions server/source/source.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ export class SourceController {
}

@ApiTags("source")
@Get("api/source/:targetId")
public async getSourcesClaim(@Param() params, @Query() getSources: any) {
@Get("api/source/target/:targetId")
public async getSourcesByTargetId(
@Param() params,
@Query() getSources: any
) {
const { targetId } = params;
const { page, order } = getSources;
const pageSize = parseInt(getSources.pageSize, 10);
Expand Down
4 changes: 2 additions & 2 deletions server/tests/source.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ describe("SourceController (e2e)", () => {
});
});

it("/api/source/:targetId (GET) - Should get sources by targetId", () => {
it("/api/source/target/:targetId (GET) - Should get sources by targetId", () => {
return request(app.getHttpServer())
.get(`/api/source/${targetId}`)
.get(`/api/source/target/${targetId}`)
.query({
page: 0,
order: "asc",
Expand Down
2 changes: 1 addition & 1 deletion src/api/sourceApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const getByTargetId = (options: optionsType) => {
language: options?.i18n?.languages[0],
};
return request
.get(`${options.targetId}`, { params })
.get(`/target/${options.targetId}`, { params })
.then((response) => {
const { sources, totalPages, totalSources } = response.data;
return {
Expand Down

0 comments on commit 8c87b90

Please sign in to comment.