@@ -24,8 +24,70 @@ describe('INFINITE_MESSAGES', () => {
24
24
} )
25
25
describe ( 'PENDING_CREATE_DB' , ( ) => {
26
26
it ( 'should render message' , ( ) => {
27
- const { Inner } = INFINITE_MESSAGES . PENDING_CREATE_DB
27
+ const { Inner } = INFINITE_MESSAGES . PENDING_CREATE_DB ( )
28
28
expect ( render ( < > { Inner } </ > ) ) . toBeTruthy ( )
29
29
} )
30
30
} )
31
+ describe ( 'DATABASE_EXISTS' , ( ) => {
32
+ it ( 'should render message' , ( ) => {
33
+ const { Inner } = INFINITE_MESSAGES . DATABASE_EXISTS ( jest . fn ( ) )
34
+ expect ( render ( < > { Inner } </ > ) ) . toBeTruthy ( )
35
+ } )
36
+
37
+ it ( 'should call onSuccess' , ( ) => {
38
+ const onSuccess = jest . fn ( )
39
+ const { Inner } = INFINITE_MESSAGES . DATABASE_EXISTS ( onSuccess )
40
+ render ( < > { Inner } </ > )
41
+
42
+ fireEvent . click ( screen . getByTestId ( 'import-db-sso-btn' ) )
43
+ fireEvent . mouseUp ( screen . getByTestId ( 'database-exists-notification' ) )
44
+ fireEvent . mouseDown ( screen . getByTestId ( 'database-exists-notification' ) )
45
+
46
+ expect ( onSuccess ) . toBeCalled ( )
47
+ } )
48
+
49
+ it ( 'should call onCancel' , ( ) => {
50
+ const onSuccess = jest . fn ( )
51
+ const onCancel = jest . fn ( )
52
+ const { Inner } = INFINITE_MESSAGES . DATABASE_EXISTS ( onSuccess , onCancel )
53
+ render ( < > { Inner } </ > )
54
+
55
+ fireEvent . click ( screen . getByTestId ( 'cancel-import-db-sso-btn' ) )
56
+ fireEvent . mouseUp ( screen . getByTestId ( 'database-exists-notification' ) )
57
+ fireEvent . mouseDown ( screen . getByTestId ( 'database-exists-notification' ) )
58
+
59
+ expect ( onCancel ) . toBeCalled ( )
60
+ } )
61
+ } )
62
+ describe ( 'SUBSCRIPTION_EXISTS' , ( ) => {
63
+ it ( 'should render message' , ( ) => {
64
+ const { Inner } = INFINITE_MESSAGES . SUBSCRIPTION_EXISTS ( jest . fn ( ) )
65
+ expect ( render ( < > { Inner } </ > ) ) . toBeTruthy ( )
66
+ } )
67
+
68
+ it ( 'should call onSuccess' , ( ) => {
69
+ const onSuccess = jest . fn ( )
70
+ const { Inner } = INFINITE_MESSAGES . SUBSCRIPTION_EXISTS ( onSuccess )
71
+ render ( < > { Inner } </ > )
72
+
73
+ fireEvent . click ( screen . getByTestId ( 'create-subscription-sso-btn' ) )
74
+ fireEvent . mouseUp ( screen . getByTestId ( 'subscription-exists-notification' ) )
75
+ fireEvent . mouseDown ( screen . getByTestId ( 'subscription-exists-notification' ) )
76
+
77
+ expect ( onSuccess ) . toBeCalled ( )
78
+ } )
79
+
80
+ it ( 'should call onCancel' , ( ) => {
81
+ const onSuccess = jest . fn ( )
82
+ const onCancel = jest . fn ( )
83
+ const { Inner } = INFINITE_MESSAGES . SUBSCRIPTION_EXISTS ( onSuccess , onCancel )
84
+ render ( < > { Inner } </ > )
85
+
86
+ fireEvent . click ( screen . getByTestId ( 'cancel-create-subscription-sso-btn' ) )
87
+ fireEvent . mouseUp ( screen . getByTestId ( 'subscription-exists-notification' ) )
88
+ fireEvent . mouseDown ( screen . getByTestId ( 'subscription-exists-notification' ) )
89
+
90
+ expect ( onCancel ) . toBeCalled ( )
91
+ } )
92
+ } )
31
93
} )
0 commit comments