import { INestApplication } from '@nestjs/common'; import request from 'supertest'; import { App } from 'supertest/types'; export interface AuthTokensBody { accessToken: string; refreshToken: string; } export interface UserBody { id: string; email: string; name: string; role: string; isActive: boolean; createdAt: string; deactivatedAt: string | null; } export async function login( app: INestApplication, email: string, password: string, ): Promise { const response = await request(app.getHttpServer()) .post('/api/v1/auth/login') .send({ email, password }) .expect(200); return response.body as AuthTokensBody; }