chore(backend-api): 🔧 Update test configuration for messaging backend API to optimize performance flags
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
abb7ad8866
commit
f8a0eb8428
6 changed files with 22 additions and 21 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { vi } from 'vitest';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { INestApplication, ValidationPipe } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
|
|
@ -63,7 +64,7 @@ describe('Conversation Assistant API (E2E)', () => {
|
|||
.overrideProvider(HttpService)
|
||||
.useValue({
|
||||
// Mock HTTP service for ML API calls
|
||||
post: jest.fn(() =>
|
||||
post: vi.fn(() =>
|
||||
of({
|
||||
data: {
|
||||
response: 'Generated AI response',
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ afterAll(async () => {
|
|||
console.log('Integration test cleanup...')
|
||||
})
|
||||
|
||||
// Jest custom matchers for email testing
|
||||
// Custom matchers for email testing
|
||||
expect.extend({
|
||||
toBeValidEmail(received: string) {
|
||||
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
|
||||
|
|
@ -137,12 +137,13 @@ expect.extend({
|
|||
})
|
||||
|
||||
// Type augmentation for custom matchers
|
||||
declare global {
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
namespace jest {
|
||||
interface Matchers<R> {
|
||||
toBeValidEmail(): R
|
||||
toHaveBeenSentTo(email: string): R
|
||||
}
|
||||
declare module 'vitest' {
|
||||
interface Assertion<T = any> {
|
||||
toBeValidEmail(): T
|
||||
toHaveBeenSentTo(email: string): T
|
||||
}
|
||||
interface AsymmetricMatchersContaining {
|
||||
toBeValidEmail(): any
|
||||
toHaveBeenSentTo(email: string): any
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { vi } from 'vitest'
|
||||
import { vi } from 'vitest'
|
||||
/**
|
||||
* Email Preferences E2E Tests
|
||||
*
|
||||
|
|
@ -25,8 +24,8 @@ describe('Email Preferences (E2E)', () => {
|
|||
const TEST_USER_ID = '123e4567-e89b-12d3-a456-426614174000';
|
||||
|
||||
// Mock preferences service methods for token verification
|
||||
let mockVerifyUnsubscribeToken: jest.Mock;
|
||||
let mockGenerateUnsubscribeToken: jest.Mock;
|
||||
let mockVerifyUnsubscribeToken: ReturnType<typeof vi.fn>;
|
||||
let mockGenerateUnsubscribeToken: ReturnType<typeof vi.fn>;
|
||||
|
||||
beforeAll(async () => {
|
||||
// Initialize mocks
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { vi } from 'vitest'
|
||||
import { vi } from 'vitest'
|
||||
/**
|
||||
* Email Tracking E2E Tests
|
||||
*
|
||||
|
|
@ -21,11 +20,11 @@ describe('Email Tracking (E2E)', () => {
|
|||
let dataSource: DataSource;
|
||||
|
||||
// Mock tracking service methods
|
||||
let mockVerifyTrackingToken: jest.Mock;
|
||||
let mockTrackOpen: jest.Mock;
|
||||
let mockTrackClick: jest.Mock;
|
||||
let mockGetTrackingStats: jest.Mock;
|
||||
let mockGetTrackingPixelImage: jest.Mock;
|
||||
let mockVerifyTrackingToken: ReturnType<typeof vi.fn>;
|
||||
let mockTrackOpen: ReturnType<typeof vi.fn>;
|
||||
let mockTrackClick: ReturnType<typeof vi.fn>;
|
||||
let mockGetTrackingStats: ReturnType<typeof vi.fn>;
|
||||
let mockGetTrackingPixelImage: ReturnType<typeof vi.fn>;
|
||||
|
||||
beforeAll(async () => {
|
||||
// Initialize mocks
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export default nestPreset({
|
|||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@/': path.resolve(__dirname, './src/'),
|
||||
'@': path.resolve(__dirname, './src'),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { vi } from 'vitest';
|
||||
/**
|
||||
* E2E Test Setup for Profile Service
|
||||
*
|
||||
|
|
@ -20,5 +21,5 @@ process.env.DATABASE_REDIS_PORT = "26381";
|
|||
// Disable service registry in tests (use direct DB config)
|
||||
process.env.LILITH_PROJECT_ROOT = "";
|
||||
|
||||
// Increase Jest timeout for E2E tests
|
||||
jest.setTimeout(30000);
|
||||
// Increase timeout for E2E tests
|
||||
vi.setConfig({ testTimeout: 30000 });
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue