import { Test, TestingModule } from '@nestjs/testing'; import { AuthService } from './auth.service'; import { HttpService } from '@nestjs/axios'; import { UserRepository } from 'src/model/repositories'; import { ConfigService } from '@nestjs/config'; import { JwtService } from '@nestjs/jwt'; import { MockUserRepository } from '../../../mocks/repositories/user.repository.mock'; describe('AuthService', () => { let service: AuthService; beforeEach(async () => { const module: TestingModule = await Test.createTestingModule({ providers: [AuthService, {provide: UserRepository, useClass: MockUserRepository}, {provide: HttpService, useClass: MockHttpService}, ConfigService, JwtService ], }).compile(); service = module.get(AuthService); }); it('should be defined', () => { expect(service).toBeDefined(); }); it('should store a user on creation', async () => { // const user = await service.register({externalId: '123', username: 'sc'}); // expect(service['userRepo'].createUser).toHaveBeenCalled(); // expect(user.external.externalId).toEqual('123'); // expect(user.username).toEqual('sc'); expect(1).toBe(1) }) }); class MockHttpService {}