Skip to content

Commit

Permalink
fix inject auth service error (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
tinpham5614 authored Dec 8, 2023
1 parent b825c31 commit e6c42d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/auth/controllers/auth.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ describe('AuthController', () => {
controllers: [AuthController],
providers: [
{
provide: 'AUTH_SERVICE',
provide: AuthService,
useValue: mockAuthService,
},
],
}).compile();

authController = module.get<AuthController>(AuthController);
authService = module.get<AuthService>('AUTH_SERVICE');
authService = module.get<AuthService>(AuthService);
jest.clearAllMocks();
});

Expand Down
6 changes: 2 additions & 4 deletions src/auth/controllers/auth.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Body, Controller, Inject, Post } from '@nestjs/common';
import { Body, Controller, Post } from '@nestjs/common';
import { AuthService } from '../services/auth.service';
import { LoginDto } from '../dto/login.dto';
import { SignUpDto } from '../dto/signup.dto';
Expand All @@ -7,9 +7,7 @@ import { ForgotPasswordDto } from '../dto/forgot-password.dto';
@Controller('auth')
export class AuthController {
// private so it is only accessed within this class
constructor(
@Inject('AUTH_SERVICE') private readonly authService: AuthService,
) {}
constructor(private readonly authService: AuthService) {}

@Post('/signup')
signUp(@Body() signUpDto: SignUpDto): Promise<{ token: string }> {
Expand Down

0 comments on commit e6c42d2

Please sign in to comment.