Skip to content

Commit 8c7723d

Browse files
committed
requested changes made
1. Added warning in case if the error is not AbortError to get more info about the error 2. updated the msw mock to follow convention of other msw mocks
1 parent 963b990 commit 8c7723d

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

app/utils/auth.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ export async function checkCommonPassword(password: string) {
283283
if (error instanceof DOMException && error.name === 'AbortError') {
284284
console.warn('Password check timed out')
285285
}
286+
console.warn('unknow error during password check', error)
286287
return false
287288
}
288289
}

tests/mocks/common-password.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { http, HttpResponse } from 'msw'
22

3-
export const pwnedPasswordApiHandler = http.get(
4-
'https://api.pwnedpasswords.com/range/:prefix',
5-
() => {
3+
export const pwnedPasswordApiHandlers = [
4+
http.get('https://api.pwnedpasswords.com/range/:prefix', () => {
65
return new HttpResponse('', { status: 200 })
7-
},
8-
)
6+
}),
7+
]

tests/mocks/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import closeWithGrace from 'close-with-grace'
22
import { setupServer } from 'msw/node'
3-
import { pwnedPasswordApiHandler } from './common-password.ts'
3+
import { pwnedPasswordApiHandlers } from './common-password.ts'
44
import { handlers as githubHandlers } from './github.ts'
55
import { handlers as resendHandlers } from './resend.ts'
66
import { handlers as tigrisHandlers } from './tigris.ts'
@@ -9,7 +9,7 @@ export const server = setupServer(
99
...resendHandlers,
1010
...githubHandlers,
1111
...tigrisHandlers,
12-
pwnedPasswordApiHandler,
12+
...pwnedPasswordApiHandlers,
1313
)
1414

1515
server.listen({

0 commit comments

Comments
 (0)