forked from fga-eps-mds/2024.1-CALCULUS-UserService
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from fga-eps-mds/fix#110/jwt-payload
[FIX] Substitui atributo 'id' por 'userId' no payload do JWT (fga-eps-mds/2024.2-ARANDU-DOC#110)
- Loading branch information
Showing
3 changed files
with
27 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { Logger, UnauthorizedException } from '@nestjs/common'; | ||
import { ConfigService } from '@nestjs/config'; | ||
import { JwtService } from '@nestjs/jwt'; | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { Request } from 'express'; | ||
import { AuthController } from 'src/auth/auth.controller'; | ||
import { AuthService } from 'src/auth/auth.service'; | ||
import { JwtService } from '@nestjs/jwt'; | ||
import { ConfigService } from '@nestjs/config'; | ||
import { Logger, UnauthorizedException } from '@nestjs/common'; | ||
import { Request } from 'express'; | ||
|
||
describe('AuthController', () => { | ||
let authController: AuthController; | ||
|
@@ -58,7 +58,7 @@ describe('AuthController', () => { | |
const result = { | ||
accessToken: 'token', | ||
refreshToken: 'refresh-token', | ||
id: 1, | ||
userId: 1, | ||
name: 'Test User', | ||
email: '[email protected]', | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { JwtService } from '@nestjs/jwt'; | ||
import { EmailService } from 'src/users/email.service'; | ||
import { NotFoundException, UnauthorizedException } from '@nestjs/common'; | ||
import { ConfigService } from '@nestjs/config'; | ||
import { Model } from 'mongoose'; | ||
import { JwtService } from '@nestjs/jwt'; | ||
import { getModelToken } from '@nestjs/mongoose'; | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import * as bcrypt from 'bcryptjs'; | ||
import { Model } from 'mongoose'; | ||
import { AuthService } from 'src/auth/auth.service'; | ||
import { EmailService } from 'src/users/email.service'; | ||
import { RefreshToken } from 'src/users/interface/refresh-token.schema'; | ||
import { ResetToken } from 'src/users/interface/reset-token.schema'; | ||
import { User } from 'src/users/interface/user.interface'; | ||
import * as bcrypt from 'bcryptjs'; | ||
import { UsersService } from 'src/users/users.service'; | ||
import { AuthService } from 'src/auth/auth.service'; | ||
import { NotFoundException, UnauthorizedException } from '@nestjs/common'; | ||
|
||
describe('AuthService', () => { | ||
let service: AuthService; | ||
|
@@ -90,7 +90,7 @@ describe('AuthService', () => { | |
|
||
const result = await service.login(user); | ||
expect(result).toEqual({ | ||
id: 'user-id', | ||
userId: 'user-id', | ||
name: 'Test User', | ||
email: '[email protected]', | ||
accessToken: 'access-token', | ||
|
@@ -127,7 +127,7 @@ describe('AuthService', () => { | |
jest.spyOn(service, 'storeRefreshToken').mockResolvedValue(undefined); | ||
|
||
const result = await service.generateTokens({ | ||
id: 'user-id', | ||
userId: 'user-id', | ||
name: 'Test User', | ||
email: '[email protected]', | ||
role: 'user', | ||
|