@@ -76,6 +76,94 @@ describe('PluginLoadedMessage', () => {
76
76
) . toEqual ( false )
77
77
} )
78
78
} )
79
+ describe ( 'subscribeState' , ( ) => {
80
+ it ( 'is optional' , ( ) => {
81
+ expect (
82
+ isPluginLoadedMessage ( {
83
+ ...stub ,
84
+ subscribeState : undefined ,
85
+ } ) ,
86
+ ) . toEqual ( true )
87
+ } )
88
+ it ( 'is a boolean' , ( ) => {
89
+ expect (
90
+ isPluginLoadedMessage ( {
91
+ ...stub ,
92
+ subscribeState : true ,
93
+ } ) ,
94
+ ) . toEqual ( true )
95
+ expect (
96
+ isPluginLoadedMessage ( {
97
+ ...stub ,
98
+ subscribeState : false ,
99
+ } ) ,
100
+ ) . toEqual ( true )
101
+ const { subscribeState : _subscribeState , ...subWithoutSubscribeState } = stub
102
+ expect ( isPluginLoadedMessage ( subWithoutSubscribeState ) ) . toEqual ( true )
103
+ expect (
104
+ isPluginLoadedMessage ( {
105
+ ...stub ,
106
+ subscribeState : 'false' ,
107
+ } ) ,
108
+ ) . toEqual ( false )
109
+ expect (
110
+ isPluginLoadedMessage ( {
111
+ ...stub ,
112
+ subscribeState : 123 ,
113
+ } ) ,
114
+ ) . toEqual ( false )
115
+ expect (
116
+ isPluginLoadedMessage ( {
117
+ ...stub ,
118
+ subscribeState : null ,
119
+ } ) ,
120
+ ) . toEqual ( false )
121
+ } )
122
+ } )
123
+ describe ( 'usePortalModal' , ( ) => {
124
+ it ( 'is optional' , ( ) => {
125
+ expect (
126
+ isPluginLoadedMessage ( {
127
+ ...stub ,
128
+ subscribeState : undefined ,
129
+ } ) ,
130
+ ) . toEqual ( true )
131
+ } )
132
+ it ( 'is a boolean' , ( ) => {
133
+ expect (
134
+ isPluginLoadedMessage ( {
135
+ ...stub ,
136
+ subscribeState : true ,
137
+ } ) ,
138
+ ) . toEqual ( true )
139
+ expect (
140
+ isPluginLoadedMessage ( {
141
+ ...stub ,
142
+ subscribeState : false ,
143
+ } ) ,
144
+ ) . toEqual ( true )
145
+ const { subscribeState : _subscribeState , ...subWithoutSubscribeState } = stub
146
+ expect ( isPluginLoadedMessage ( subWithoutSubscribeState ) ) . toEqual ( true )
147
+ expect (
148
+ isPluginLoadedMessage ( {
149
+ ...stub ,
150
+ subscribeState : 'false' ,
151
+ } ) ,
152
+ ) . toEqual ( false )
153
+ expect (
154
+ isPluginLoadedMessage ( {
155
+ ...stub ,
156
+ subscribeState : 123 ,
157
+ } ) ,
158
+ ) . toEqual ( false )
159
+ expect (
160
+ isPluginLoadedMessage ( {
161
+ ...stub ,
162
+ subscribeState : null ,
163
+ } ) ,
164
+ ) . toEqual ( false )
165
+ } )
166
+ } )
79
167
} )
80
168
describe ( 'constructor' , ( ) => {
81
169
it ( 'includes the uid' , ( ) => {
@@ -90,5 +178,17 @@ describe('PluginLoadedMessage', () => {
90
178
true ,
91
179
)
92
180
} )
181
+ it ( 'sets subscribeState to true' , ( ) => {
182
+ expect ( pluginLoadedMessage ( { uid, callbackId } ) ) . toHaveProperty (
183
+ 'subscribeState' ,
184
+ true ,
185
+ )
186
+ } )
187
+ it ( 'sets usePortalModal to true' , ( ) => {
188
+ expect ( pluginLoadedMessage ( { uid, callbackId } ) ) . toHaveProperty (
189
+ 'usePortalModal' ,
190
+ true ,
191
+ )
192
+ } )
93
193
} )
94
194
} )
0 commit comments