@@ -4,7 +4,6 @@ import { EMPTY } from "rxjs";
4
4
import { TestWrapper } from "test-utils/testutils" ;
5
5
6
6
import type { useExperiment } from "hooks/services/Experiment" ;
7
- import type { Experiments } from "hooks/services/Experiment/experiments" ;
8
7
9
8
const mockUseExperiment = jest . fn < ReturnType < typeof useExperiment > , Parameters < typeof useExperiment > > ( ) ;
10
9
jest . doMock ( "hooks/services/Experiment" , ( ) => ( {
@@ -22,28 +21,6 @@ jest.doMock("packages/cloud/services/auth/AuthService", () => ({
22
21
// eslint-disable-next-line @typescript-eslint/no-var-requires
23
22
const { OAuthLogin } = require ( "./OAuthLogin" ) ;
24
23
25
- const createUseExperimentMock = ( options : {
26
- google ?: boolean ;
27
- github ?: boolean ;
28
- googleSignUp ?: boolean ;
29
- githubSignUp ?: boolean ;
30
- } ) => {
31
- return ( key : keyof Experiments ) => {
32
- switch ( key ) {
33
- case "authPage.oauth.github" :
34
- return options . github ?? false ;
35
- case "authPage.oauth.google" :
36
- return options . google ?? false ;
37
- case "authPage.oauth.github.signUpPage" :
38
- return options . githubSignUp ?? true ;
39
- case "authPage.oauth.google.signUpPage" :
40
- return options . googleSignUp ?? true ;
41
- default :
42
- throw new Error ( `${ key } is not mocked` ) ;
43
- }
44
- } ;
45
- } ;
46
-
47
24
describe ( "OAuthLogin" , ( ) => {
48
25
beforeEach ( ( ) => {
49
26
mockUseExperiment . mockReset ( ) ;
@@ -52,27 +29,6 @@ describe("OAuthLogin", () => {
52
29
mockLoginWithOAuth . mockReturnValue ( EMPTY ) ;
53
30
} ) ;
54
31
55
- it ( "should render all enabled logins" , ( ) => {
56
- mockUseExperiment . mockImplementation ( createUseExperimentMock ( { google : true , github : true } ) ) ;
57
- const { getByTestId } = render ( < OAuthLogin /> , { wrapper : TestWrapper } ) ;
58
- expect ( getByTestId ( "googleOauthLogin" ) ) . toBeInTheDocument ( ) ;
59
- expect ( getByTestId ( "githubOauthLogin" ) ) . toBeInTheDocument ( ) ;
60
- } ) ;
61
-
62
- it ( "should not render buttons that are disabled" , ( ) => {
63
- mockUseExperiment . mockImplementation ( createUseExperimentMock ( { google : false , github : true } ) ) ;
64
- const { getByTestId, queryByTestId } = render ( < OAuthLogin /> , { wrapper : TestWrapper } ) ;
65
- expect ( queryByTestId ( "googleOauthLogin" ) ) . not . toBeInTheDocument ( ) ;
66
- expect ( getByTestId ( "githubOauthLogin" ) ) . toBeInTheDocument ( ) ;
67
- } ) ;
68
-
69
- it ( "should not render disabled buttons for sign-up page" , ( ) => {
70
- mockUseExperiment . mockImplementation ( createUseExperimentMock ( { google : true , github : true , googleSignUp : false } ) ) ;
71
- const { getByTestId, queryByTestId } = render ( < OAuthLogin isSignUpPage /> , { wrapper : TestWrapper } ) ;
72
- expect ( queryByTestId ( "googleOauthLogin" ) ) . not . toBeInTheDocument ( ) ;
73
- expect ( getByTestId ( "githubOauthLogin" ) ) . toBeInTheDocument ( ) ;
74
- } ) ;
75
-
76
32
it ( "should call auth service for Google" , ( ) => {
77
33
const { getByTestId } = render ( < OAuthLogin /> , { wrapper : TestWrapper } ) ;
78
34
userEvents . click ( getByTestId ( "googleOauthLogin" ) ) ;
0 commit comments