Skip to content

API: Implement 92.24% test coverage#1481

Merged
MrDirkelz merged 4 commits intomainfrom
1464-api-implement-full-test-coverage
Apr 9, 2026
Merged

API: Implement 92.24% test coverage#1481
MrDirkelz merged 4 commits intomainfrom
1464-api-implement-full-test-coverage

Conversation

@MrDirkelz
Copy link
Copy Markdown
Collaborator

No description provided.

@MrDirkelz MrDirkelz linked an issue Apr 7, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Collaborator

@johan-bell johan-bell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments

Comment on lines +20 to +28
const s3Endpoint = process.env.S3_ENDPOINT || "127.0.0.1";
const s3Port = process.env.S3_PORT || "9000";
const s3AccessKey = process.env.S3_ACCESS_KEY || "minio";
const s3SecretKey = process.env.S3_SECRET_KEY || "minio123";
const s3UseSsl = process.env.S3_USE_SSL === "true";
const s3Protocol = s3UseSsl ? "https" : "http";
const s3BaseUrl = `${s3Protocol}://${s3Endpoint}:${s3Port}`;
const s3PublicUrl = process.env.S3_PUBLIC_URL || "http://localhost:9000";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have duplicate declaration here. check ligne 181 - 188

Comment on lines +181 to +189
const s3Endpoint = process.env.S3_ENDPOINT || "127.0.0.1";
const s3Port = process.env.S3_PORT || "9000";
const s3AccessKey = process.env.S3_ACCESS_KEY || "minio";
const s3SecretKey = process.env.S3_SECRET_KEY || "minio123";
const s3UseSsl = process.env.S3_USE_SSL === "true";
const s3Protocol = s3UseSsl ? "https" : "http";
const s3BaseUrl = `${s3Protocol}://${s3Endpoint}:${s3Port}`;
const s3PublicUrl = process.env.S3_PUBLIC_URL || "http://localhost:9000";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate

Comment on lines +539 to +547
const s3Endpoint = process.env.S3_ENDPOINT || "127.0.0.1";
const s3Port = process.env.S3_PORT || "9000";
const s3AccessKey = process.env.S3_ACCESS_KEY || "minio";
const s3SecretKey = process.env.S3_SECRET_KEY || "minio123";
const s3UseSsl = process.env.S3_USE_SSL === "true";
const s3Protocol = s3UseSsl ? "https" : "http";
const s3BaseUrl = `${s3Protocol}://${s3Endpoint}:${s3Port}`;
const s3PublicUrl = process.env.S3_PUBLIC_URL || "http://localhost:9000";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate

Comment on lines +19 to +27
const s3Endpoint = process.env.S3_ENDPOINT || "127.0.0.1";
const s3Port = process.env.S3_PORT || "9000";
const s3AccessKey = process.env.S3_ACCESS_KEY || "minio";
const s3SecretKey = process.env.S3_SECRET_KEY || "minio123";
const s3UseSsl = process.env.S3_USE_SSL === "true";
const s3Protocol = s3UseSsl ? "https" : "http";
const s3BaseUrl = `${s3Protocol}://${s3Endpoint}:${s3Port}`;
const s3PublicUrl = process.env.S3_PUBLIC_URL || "http://localhost:9000";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be make a reusable function or file that will be used in the tests ?

Comment on lines +25 to +34
it("should include hlsUrl when both mediaType and hlsUrl are provided", () => {
const result = createUploadData(mockFile, "default", {
mediaType: MediaType.Video,
hlsUrl: "https://example.com/stream.m3u8",
languageId: "lang-2",
});
expect(result.hlsUrl).toBe("https://example.com/stream.m3u8");
expect(result.mediaType).toBe(MediaType.Video);
expect(result.languageId).toBe("lang-2");
});
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are we really testing here ?

Comment thread api/src/dto/ChangeReqAckDto.spec.ts Outdated
Comment on lines +1 to +20
import { ChangeReqAckDto } from "./ChangeReqAckDto";
import { AckStatus } from "../enums";

describe("ChangeReqAckDto", () => {
it("should create an instance with ack status", () => {
const dto = new ChangeReqAckDto();
dto.ack = AckStatus.Accepted;
expect(dto.ack).toBe(AckStatus.Accepted);
});

it("should support optional message and warnings", () => {
const dto = new ChangeReqAckDto();
dto.ack = AckStatus.Rejected;
dto.message = "Insufficient permissions";
dto.warnings = ["Image upload failed"];
dto.docs = [];
expect(dto.message).toBe("Insufficient permissions");
expect(dto.warnings).toHaveLength(1);
});
});
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this test is needed

Comment thread api/src/dto/DeleteCmdDto.spec.ts Outdated
Comment on lines +35 to +43
it("should create instance with all properties", () => {
const dto = createValid();
dto.memberOf = ["group-1"];
dto.newMemberOf = ["group-2"];
dto.language = "lang-1";
dto.slug = "my-slug";
expect(dto.memberOf).toEqual(["group-1"]);
expect(dto.newMemberOf).toEqual(["group-2"]);
});
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test needed ?


service = (await createTestingModule("search-service")).dbService;
searchService = new SearchService(undefined, service);
searchService = new SearchService({ error: jest.fn(), warn: jest.fn() } as any, service);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the test failng here before the change ?

Comment thread api/src/s3/s3.service.spec.ts Outdated
Comment on lines +7 to +15
const s3Endpoint = process.env.S3_ENDPOINT || "127.0.0.1";
const s3Port = process.env.S3_PORT || "9000";
const s3AccessKey = process.env.S3_ACCESS_KEY || "minio";
const s3SecretKey = process.env.S3_SECRET_KEY || "minio123";
const s3UseSsl = process.env.S3_USE_SSL === "true";
const s3Protocol = s3UseSsl ? "https" : "http";
const s3BaseUrl = `${s3Protocol}://${s3Endpoint}:${s3Port}`;
const s3PublicUrl = process.env.S3_PUBLIC_URL || "http://localhost:9000";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate

Copy link
Copy Markdown
Contributor

@ivanslabbert ivanslabbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, but check comments from Johan

@MrDirkelz MrDirkelz force-pushed the 1464-api-implement-full-test-coverage branch from 2986cad to 2b4ecd8 Compare April 9, 2026 13:21
@MrDirkelz MrDirkelz merged commit b5db74d into main Apr 9, 2026
5 checks passed
@MrDirkelz MrDirkelz deleted the 1464-api-implement-full-test-coverage branch April 9, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API: Implement full test coverage

3 participants