-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: existing tests are working again
- Loading branch information
Showing
3 changed files
with
56 additions
and
53 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
File renamed without changes.
29 changes: 29 additions & 0 deletions
29
src/__tests__/check-that-getAuth0Client-throws-properly.test.tsx
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,29 @@ | ||
import { createAuth0Client as mockedCreateAuth0 } from '../../__mocks__/@auth0/auth0-spa-js'; | ||
import { getAuth0Client, logoutAuth } from '../utils/auth'; | ||
|
||
test('getAuth0Client failed process', async () => { | ||
expect.assertions(1); | ||
mockedCreateAuth0.mockImplementation(() => { | ||
throw new Error(); | ||
}); | ||
|
||
try { | ||
await getAuth0Client(); | ||
} catch (e) { | ||
expect(e).toEqual(new Error(`getAuth0Client Error: Error`)); | ||
} | ||
}); | ||
|
||
test('logoutAuth failed process', async () => { | ||
expect.assertions(1); | ||
// @ts-ignore make logout fail with no .logout property on client | ||
mockedCreateAuth0.mockImplementation(() => { | ||
return {}; | ||
}); | ||
|
||
try { | ||
await logoutAuth(); | ||
} catch (e) { | ||
expect(e).toEqual(new Error(`client_1.logout is not a function`)); | ||
} | ||
}); |