refactor: remove unused tests, mocks, and outdated e2e configurations
Deleted unused e2e tests, mocks (`cuid2`, `jose`, `ml-kem`, `sha3`), and their associated jest configurations. Simplified services by ensuring proper dependency imports, resolving circular references, and improving TypeScript type usage for enhanced maintainability and testability. Upgraded Dockerfile base image to match new development standards.
This commit is contained in:
@@ -34,7 +34,11 @@ describe("ReportsService", () => {
|
||||
it("should create a report", async () => {
|
||||
const reporterId = "u1";
|
||||
const data = { contentId: "c1", reason: "spam" };
|
||||
mockReportsRepository.create.mockResolvedValue({ id: "r1", ...data, reporterId });
|
||||
mockReportsRepository.create.mockResolvedValue({
|
||||
id: "r1",
|
||||
...data,
|
||||
reporterId,
|
||||
});
|
||||
|
||||
const result = await service.create(reporterId, data);
|
||||
|
||||
@@ -54,7 +58,9 @@ describe("ReportsService", () => {
|
||||
|
||||
describe("updateStatus", () => {
|
||||
it("should update report status", async () => {
|
||||
mockReportsRepository.updateStatus.mockResolvedValue([{ id: "r1", status: "resolved" }]);
|
||||
mockReportsRepository.updateStatus.mockResolvedValue([
|
||||
{ id: "r1", status: "resolved" },
|
||||
]);
|
||||
const result = await service.updateStatus("r1", "resolved");
|
||||
expect(result[0].status).toBe("resolved");
|
||||
expect(repository.updateStatus).toHaveBeenCalledWith("r1", "resolved");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Injectable, Logger } from "@nestjs/common";
|
||||
import { ReportsRepository } from "./repositories/reports.repository";
|
||||
import { CreateReportDto } from "./dto/create-report.dto";
|
||||
import { ReportsRepository } from "./repositories/reports.repository";
|
||||
|
||||
@Injectable()
|
||||
export class ReportsService {
|
||||
|
||||
@@ -11,7 +11,7 @@ export class ReportsRepository {
|
||||
reporterId: string;
|
||||
contentId?: string;
|
||||
tagId?: string;
|
||||
reason: string;
|
||||
reason: "inappropriate" | "spam" | "copyright" | "other";
|
||||
description?: string;
|
||||
}) {
|
||||
const [newReport] = await this.databaseService.db
|
||||
|
||||
Reference in New Issue
Block a user