-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #302 from amam-deriv/amam/oauth-2-logout
Amam/oauth-2-logout
- Loading branch information
Showing
13 changed files
with
246 additions
and
101 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
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,39 @@ | ||
import { renderHook } from '@testing-library/react'; | ||
import useGrowthbookGetFeatureValue from '../useGrowthbookGetFeatureValue'; | ||
import useOAuth2Enabled from '../useOAuth2Enabled'; | ||
|
||
jest.mock('@/constants', () => ({ | ||
getServerInfo: jest.fn(() => ({ | ||
appId: '111', // emulate local appId | ||
})), | ||
})); | ||
|
||
jest.mock('../useGrowthbookGetFeatureValue'); | ||
|
||
describe('useOAuth2Enabled', () => { | ||
it('OAuth 2 enabled', () => { | ||
const emulateAppIdAvailable = [ | ||
{}, | ||
{ | ||
enabled_for: [111], | ||
}, | ||
]; | ||
(useGrowthbookGetFeatureValue as jest.Mock).mockReturnValue([emulateAppIdAvailable, true]); | ||
const { result } = renderHook(() => useOAuth2Enabled()); | ||
|
||
expect(result.current).toStrictEqual([true]); | ||
}); | ||
|
||
it('OAuth 2 disabled', () => { | ||
const emulateAppIdAvailable = [ | ||
{}, | ||
{ | ||
enabled_for: [112], | ||
}, | ||
]; | ||
(useGrowthbookGetFeatureValue as jest.Mock).mockReturnValue([emulateAppIdAvailable, true]); | ||
const { result } = renderHook(() => useOAuth2Enabled()); | ||
|
||
expect(result.current).toStrictEqual([false]); | ||
}); | ||
}); |
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
Oops, something went wrong.