website refactor

This commit is contained in:
2026-01-16 12:55:48 +01:00
parent 0208334c59
commit 20a42c52fd
83 changed files with 1610 additions and 1238 deletions

View File

@@ -1,6 +1,6 @@
import 'reflect-metadata';
import { ValidationPipe } from '@nestjs/common';
import { ValidationPipe, INestApplication } from '@nestjs/common';
import { Reflector } from '@nestjs/core';
import { Test } from '@nestjs/testing';
import request from 'supertest';
@@ -15,7 +15,7 @@ import { FeatureAvailabilityGuard } from '../policy/FeatureAvailabilityGuard';
describe('Admin domain (HTTP, module-wiring)', () => {
const originalEnv = { ...process.env };
let app: any;
let app: INestApplication;
beforeAll(async () => {
vi.resetModules();
@@ -62,9 +62,9 @@ describe('Admin domain (HTTP, module-wiring)', () => {
};
app.useGlobalGuards(
new AuthenticationGuard(sessionPort as any),
new AuthorizationGuard(reflector, authorizationService as any),
new FeatureAvailabilityGuard(reflector, policyService as any),
new AuthenticationGuard(sessionPort as never),
new AuthorizationGuard(reflector, authorizationService as never),
new FeatureAvailabilityGuard(reflector, policyService as never),
);
await app.init();

View File

@@ -48,7 +48,7 @@ describe('AdminController', () => {
limit: 10,
};
const req = { user: { userId: 'admin-1' } } as any;
const req = { user: { userId: 'admin-1' } } as never;
const result = await controller.listUsers(query, req);
expect(mockService.listUsers).toHaveBeenCalledWith({
@@ -81,7 +81,7 @@ describe('AdminController', () => {
sortDirection: 'desc',
};
const req = { user: { userId: 'owner-1' } } as any;
const req = { user: { userId: 'owner-1' } } as never;
const result = await controller.listUsers(query, req);
expect(mockService.listUsers).toHaveBeenCalledWith({
@@ -110,7 +110,7 @@ describe('AdminController', () => {
mockService.listUsers.mockResolvedValue(mockResponse);
const query: ListUsersRequestDto = { page: 1, limit: 10 };
const req = {} as any;
const req = {} as never;
await controller.listUsers(query, req);
@@ -137,7 +137,7 @@ describe('AdminController', () => {
limit: 10,
};
const req = { user: { userId: 'admin-1' } } as any;
const req = { user: { userId: 'admin-1' } } as never;
await controller.listUsers(query, req);
expect(mockService.listUsers).toHaveBeenCalledWith({
@@ -170,7 +170,7 @@ describe('AdminController', () => {
mockService.getDashboardStats.mockResolvedValue(mockStats);
const req = { user: { userId: 'admin-1' } } as any;
const req = { user: { userId: 'admin-1' } } as never;
const result = await controller.getDashboardStats(req);
expect(mockService.getDashboardStats).toHaveBeenCalledWith({
@@ -200,7 +200,7 @@ describe('AdminController', () => {
mockService.getDashboardStats.mockResolvedValue(mockStats);
const req = {} as any;
const req = {} as never;
const result = await controller.getDashboardStats(req);
expect(mockService.getDashboardStats).toHaveBeenCalledWith({
@@ -212,7 +212,7 @@ describe('AdminController', () => {
it('should handle service errors gracefully', async () => {
mockService.getDashboardStats.mockRejectedValue(new Error('Database connection failed'));
const req = { user: { userId: 'admin-1' } } as any;
const req = { user: { userId: 'admin-1' } } as never;
await expect(controller.getDashboardStats(req)).rejects.toThrow('Database connection failed');
});

View File

@@ -19,8 +19,8 @@ describe('AdminService', () => {
beforeEach(() => {
vi.clearAllMocks();
service = new AdminService(
mockListUsersUseCase as any,
mockGetDashboardStatsUseCase as any
mockListUsersUseCase as never,
mockGetDashboardStatsUseCase as never
);
});

View File

@@ -79,8 +79,8 @@ describe('ListUsersRequestDto', () => {
it('should handle numeric string values for pagination', () => {
// Arrange & Act
const dto = new ListUsersRequestDto();
dto.page = '5' as any;
dto.limit = '25' as any;
dto.page = '5' as never;
dto.limit = '25' as never;
// Assert - Should accept the values
expect(dto.page).toBe('5');