@@ -164,6 +164,102 @@ describe('server', () => {
164
164
} )
165
165
} ) ;
166
166
167
+ it ( 'can properly sets the push support' , done => {
168
+ // default config passes push options
169
+ const config = new Config ( 'test' ) ;
170
+ expect ( config . hasPushSupport ) . toEqual ( true ) ;
171
+ expect ( config . hasPushScheduledSupport ) . toEqual ( false ) ;
172
+ request . get ( {
173
+ url : 'http://localhost:8378/1/serverInfo' ,
174
+ headers : {
175
+ 'X-Parse-Application-Id' : 'test' ,
176
+ 'X-Parse-Master-Key' : 'test' ,
177
+ } ,
178
+ json : true ,
179
+ } , ( error , response , body ) => {
180
+ expect ( body . features . push . immediatePush ) . toEqual ( true ) ;
181
+ expect ( body . features . push . scheduledPush ) . toEqual ( false ) ;
182
+ done ( ) ;
183
+ } )
184
+ } ) ;
185
+
186
+ it ( 'can properly sets the push support when not configured' , done => {
187
+ reconfigureServer ( {
188
+ push : undefined // force no config
189
+ } ) . then ( ( ) => {
190
+ const config = new Config ( 'test' ) ;
191
+ expect ( config . hasPushSupport ) . toEqual ( false ) ;
192
+ expect ( config . hasPushScheduledSupport ) . toEqual ( false ) ;
193
+ request . get ( {
194
+ url : 'http://localhost:8378/1/serverInfo' ,
195
+ headers : {
196
+ 'X-Parse-Application-Id' : 'test' ,
197
+ 'X-Parse-Master-Key' : 'test' ,
198
+ } ,
199
+ json : true ,
200
+ } , ( error , response , body ) => {
201
+ expect ( body . features . push . immediatePush ) . toEqual ( false ) ;
202
+ expect ( body . features . push . scheduledPush ) . toEqual ( false ) ;
203
+ done ( ) ;
204
+ } )
205
+ } ) . catch ( done . fail ) ;
206
+ } ) ;
207
+
208
+ it ( 'can properly sets the push support ' , done => {
209
+ reconfigureServer ( {
210
+ push : {
211
+ adapter : {
212
+ send ( ) { } ,
213
+ getValidPushTypes ( ) { }
214
+ }
215
+ }
216
+ } ) . then ( ( ) => {
217
+ const config = new Config ( 'test' ) ;
218
+ expect ( config . hasPushSupport ) . toEqual ( true ) ;
219
+ expect ( config . hasPushScheduledSupport ) . toEqual ( false ) ;
220
+ request . get ( {
221
+ url : 'http://localhost:8378/1/serverInfo' ,
222
+ headers : {
223
+ 'X-Parse-Application-Id' : 'test' ,
224
+ 'X-Parse-Master-Key' : 'test' ,
225
+ } ,
226
+ json : true ,
227
+ } , ( error , response , body ) => {
228
+ expect ( body . features . push . immediatePush ) . toEqual ( true ) ;
229
+ expect ( body . features . push . scheduledPush ) . toEqual ( false ) ;
230
+ done ( ) ;
231
+ } )
232
+ } ) . catch ( done . fail ) ;
233
+ } ) ;
234
+
235
+ it ( 'can properly sets the push schedule support' , done => {
236
+ reconfigureServer ( {
237
+ push : {
238
+ adapter : {
239
+ send ( ) { } ,
240
+ getValidPushTypes ( ) { }
241
+ }
242
+ } ,
243
+ scheduledPush : true ,
244
+ } ) . then ( ( ) => {
245
+ const config = new Config ( 'test' ) ;
246
+ expect ( config . hasPushSupport ) . toEqual ( true ) ;
247
+ expect ( config . hasPushScheduledSupport ) . toEqual ( true ) ;
248
+ request . get ( {
249
+ url : 'http://localhost:8378/1/serverInfo' ,
250
+ headers : {
251
+ 'X-Parse-Application-Id' : 'test' ,
252
+ 'X-Parse-Master-Key' : 'test' ,
253
+ } ,
254
+ json : true ,
255
+ } , ( error , response , body ) => {
256
+ expect ( body . features . push . immediatePush ) . toEqual ( true ) ;
257
+ expect ( body . features . push . scheduledPush ) . toEqual ( true ) ;
258
+ done ( ) ;
259
+ } )
260
+ } ) . catch ( done . fail ) ;
261
+ } ) ;
262
+
167
263
it ( 'can respond 200 on path health' , done => {
168
264
request . get ( {
169
265
url : 'http://localhost:8378/1/health' ,
0 commit comments