-
-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use precalculated hashes in auth testing instead of mocking
- Loading branch information
1 parent
a2da02e
commit f433ee1
Showing
5 changed files
with
35 additions
and
23 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 |
---|---|---|
|
@@ -5,5 +5,6 @@ declare namespace jest { | |
toBeSubscriptionItem(): R; | ||
toBePlan(): R; | ||
toBeUserStats(): R; | ||
toBeBcryptHash(): R; | ||
} | ||
} |
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,9 +1,9 @@ | ||
import { Request, Response } from 'express'; | ||
|
||
export function mockRequest(props?: object): Request { | ||
export function mockRequest(props?: Partial<Request>): Request { | ||
return { ...props } as Request; | ||
} | ||
|
||
export function mockResponse(props?: object): Response { | ||
export function mockResponse(props?: Partial<Response>): Response { | ||
return { ...props } as Response; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const passwordMock = '123456'; | ||
export const otherPasswordMock = 'secret'; | ||
|
||
export const passwordHashMapping = { | ||
[passwordMock]: | ||
'$2b$10$i.6ZxLRuMEZ3UvfCAjLsDO5RpJHOAwBWw.K9EDHxdYmrqNFeJ0kG2', | ||
[otherPasswordMock]: | ||
'$2b$10$0En78yD5TJvSoYLhf1vFNO4TxBa2Eyco0blVScDhf.9uGZ92zGTH.', | ||
}; |
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