-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix login, confirm code * Refresh token * Refresh token * Fix unit test * Add api logout * Add logic that check password reset period * Fix reset password * Change api endpoint * Fix unit test * Fix axios run refresh when access token expired * Fix router * Fix unit test * Lint code * User service unit test * Lint file * Fix login and add confirm code view * Lint code * Fix navigate to verify code * Remove console * Update logout feature * Fix hook * Lint code * Fix request reset password * Lint code * Fix login * Lint code * Fix logout and link to email * Lint code * Fix unit test * Remove yarn lock * lint * Fix router * Lint code * Fix build * Lint code --------- Co-authored-by: HoangPham <[email protected]>
- Loading branch information
1 parent
af742c0
commit 5021ec0
Showing
66 changed files
with
1,794 additions
and
804 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
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
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 |
---|---|---|
|
@@ -10,6 +10,8 @@ import { ConfirmCodeService } from '../user/confirm-code.service' | |
import { UserEntity } from '../entities/user.entity' | ||
import { SignUpWithEmailCredentialsDto } from '@isomera/dtos' | ||
import { Pure } from '@isomera/interfaces' | ||
import { OrganizationService } from '../organization/organization.service' | ||
import { ConfigService } from '@nestjs/config' | ||
|
||
describe('AuthService', () => { | ||
let service: AuthService | ||
|
@@ -20,7 +22,24 @@ describe('AuthService', () => { | |
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [AuthService] | ||
providers: [ | ||
AuthService, | ||
{ | ||
provide: ConfigService, | ||
useValue: { | ||
get: jest.fn((key: string) => { | ||
// this is being super extra, in the case that you need multiple keys with the `get` method | ||
if (key === 'JWT_ACCESS_TOKEN_EXPIRATION_TIME') { | ||
return 123 | ||
} | ||
if (key === 'JWT_REFRESH_TOKEN_EXPIRATION_TIME') { | ||
return 123 | ||
} | ||
return null | ||
}) | ||
} | ||
} | ||
] | ||
}) | ||
.useMocker(token => { | ||
if (Object.is(token, UserService)) { | ||
|
@@ -35,6 +54,14 @@ describe('AuthService', () => { | |
if (Object.is(token, ConfirmCodeService)) { | ||
return createMock<ConfirmCodeService>() | ||
} | ||
|
||
if (Object.is(token, OrganizationService)) { | ||
return createMock<OrganizationService>() | ||
} | ||
|
||
if (Object.is(token, ConfigService)) { | ||
return createMock<ConfigService>() | ||
} | ||
}) | ||
.compile() | ||
|
||
|
@@ -90,6 +117,7 @@ describe('AuthService', () => { | |
checkPassword: jest.fn().mockResolvedValue(true) | ||
}) | ||
) | ||
mockedJwtService.sign.mockReturnValue('j.w.t') | ||
const user = await service.login(email, password) | ||
|
||
expect(user).toHaveProperty('email', email) | ||
|
@@ -164,9 +192,10 @@ describe('AuthService', () => { | |
it('should sign a new JWT', () => { | ||
const user = createMock<UserEntity>({ email: '[email protected]' }) | ||
|
||
mockedJwtService.sign.mockReturnValueOnce('j.w.t') | ||
const token = service.signToken(user) | ||
mockedJwtService.sign.mockReturnValue('j.w.t') | ||
const { refresh_token, access_token } = service.signToken(user) | ||
|
||
expect(token).toEqual(expect.any(String)) | ||
expect(access_token).toEqual(expect.any(String)) | ||
expect(refresh_token).toEqual(expect.any(String)) | ||
}) | ||
}) |
Oops, something went wrong.
5021ec0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
isomera-platform – ./
app.isomera.org
isomera-platform-cortip.vercel.app
isomera.vercel.app
isomera-platform-git-main-cortip.vercel.app
5021ec0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
isomera-compodoc – ./
isomera-compodoc-cortip.vercel.app
doc.isomera.org
isomera-compodoc.vercel.app
isomera-compodoc-git-main-cortip.vercel.app