-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e1ef47
commit 4c333ed
Showing
6 changed files
with
151 additions
and
107 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { formatErrorMessage } from './formatErrorMessage' | ||
|
||
describe('formatErrorMessage', () => { | ||
it('should return "Passkey Authentication Failed"', () => { | ||
const error = new Error( | ||
'The operation either timed out or was not allowed due to security reasons' | ||
) | ||
const result = formatErrorMessage(error) | ||
expect(result).toBe('Passkey Authentication Failed') | ||
}) | ||
|
||
it('should return the original error message', () => { | ||
const error = new Error('Some other error message') | ||
const result = formatErrorMessage(error) | ||
expect(result).toBe('Some other error message') | ||
}) | ||
}) |
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,6 @@ | ||
export const formatErrorMessage = (error: Error) => { | ||
if (error.message.startsWith('The operation either timed out or was not allowed')) { | ||
return 'Passkey Authentication Failed' | ||
} | ||
return error.message | ||
} |