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:
Mathis HERRIOT
2026-01-14 13:51:32 +01:00
parent 8ffeaeba05
commit 0c045e8d3c
44 changed files with 163 additions and 183 deletions

View File

@@ -34,7 +34,9 @@ describe("FavoritesService", () => {
describe("addFavorite", () => {
it("should add a favorite", async () => {
mockFavoritesRepository.findContentById.mockResolvedValue({ id: "content1" });
mockFavoritesRepository.findContentById.mockResolvedValue({
id: "content1",
});
mockFavoritesRepository.add.mockResolvedValue([
{ userId: "u1", contentId: "content1" },
]);
@@ -53,7 +55,9 @@ describe("FavoritesService", () => {
});
it("should throw ConflictException on duplicate favorite", async () => {
mockFavoritesRepository.findContentById.mockResolvedValue({ id: "content1" });
mockFavoritesRepository.findContentById.mockResolvedValue({
id: "content1",
});
mockFavoritesRepository.add.mockRejectedValue(new Error("Duplicate"));
await expect(service.addFavorite("u1", "content1")).rejects.toThrow(
ConflictException,
@@ -63,7 +67,9 @@ describe("FavoritesService", () => {
describe("removeFavorite", () => {
it("should remove a favorite", async () => {
mockFavoritesRepository.remove.mockResolvedValue([{ userId: "u1", contentId: "c1" }]);
mockFavoritesRepository.remove.mockResolvedValue([
{ userId: "u1", contentId: "c1" },
]);
const result = await service.removeFavorite("u1", "c1");
expect(result).toEqual({ userId: "u1", contentId: "c1" });
expect(repository.remove).toHaveBeenCalledWith("u1", "c1");

View File

@@ -14,7 +14,7 @@ export class FavoritesService {
async addFavorite(userId: string, contentId: string) {
this.logger.log(`Adding favorite: user ${userId}, content ${contentId}`);
const content = await this.favoritesRepository.findContentById(contentId);
if (!content) {
throw new NotFoundException("Content not found");