@@ -149,28 +149,29 @@ describe("getEnvPaths", () => {
149
149
} )
150
150
151
151
describe ( "hash" , ( ) => {
152
- it ( "should return a hash of the string passed in" , ( ) => {
152
+ it ( "should return a hash of the string passed in" , async ( ) => {
153
153
const plainTextPassword = "mySecretPassword123"
154
- const hashed = hash ( plainTextPassword )
154
+ const hashed = await hash ( plainTextPassword )
155
155
expect ( hashed ) . not . toBe ( plainTextPassword )
156
156
} )
157
157
} )
158
158
159
159
describe ( "isHashMatch" , ( ) => {
160
- it ( "should return true if the password matches the hash" , ( ) => {
160
+ it ( "should return true if the password matches the hash" , async ( ) => {
161
161
const password = "password123"
162
- const _hash = hash ( password )
162
+ const _hash = await hash ( password )
163
163
expect ( isHashMatch ( password , _hash ) ) . toBe ( true )
164
164
} )
165
- it ( "should return false if the password does not match the hash" , ( ) => {
165
+ it ( "should return false if the password does not match the hash" , async ( ) => {
166
166
const password = "password123"
167
- const _hash = hash ( password )
167
+ const _hash = await hash ( password )
168
168
expect ( isHashMatch ( "otherPassword123" , _hash ) ) . toBe ( false )
169
169
} )
170
- it ( "should return true with actual hash" , ( ) => {
170
+ it ( "should return true with actual hash" , async ( ) => {
171
171
const password = "password"
172
172
const _hash = "$2b$10$GA/eZnlboeV9eW8LnntPqe1dZE7tQ/./wCdc7NgJhMRB.xhaJfmG."
173
- expect ( isHashMatch ( password , _hash ) ) . toBe ( true )
173
+ const actual = await isHashMatch ( password , _hash )
174
+ expect ( actual ) . toBe ( true )
174
175
} )
175
176
} )
176
177
0 commit comments