@@ -225,38 +225,25 @@ describe('Sync', () => {
225
225
expect ( deployResult . status ) . toBe ( 'created' ) ;
226
226
} ) ;
227
227
228
-
229
- it ( 'can use the allow_destructive_changes param to do a destructive rule create' , async ( ) => {
228
+ it ( 'can create a rule with invalid sync schema' , async ( ) => {
230
229
const syncService = await createSampleMongodbSyncService ( services ) ;
231
230
232
231
const schemaInvalidatingRule = {
233
232
database : 'db' ,
234
233
collection : 'coll' ,
235
234
config : {
236
235
schema : {
237
- title : 'double' ,
238
236
properties : {
239
237
_id : { bsonType : 'objectId' } ,
240
238
key : { bsonType : 'string' } ,
241
- obj : {
242
- bsonType : 'object' ,
243
- title : 'double'
244
- }
239
+ bad : { bsonType : 'null' }
245
240
}
246
241
}
247
242
}
248
243
} ;
249
244
250
- let stitchError ;
251
- try {
252
- await addRuleToMongodbService ( services , syncService , schemaInvalidatingRule ) ;
253
- } catch ( e ) {
254
- stitchError = e ;
255
- }
256
- expect ( stitchError . code ) . toBe ( 'InvalidSyncSchema' ) ;
257
-
258
- const createResult = await addRuleToMongodbService ( services , syncService , schemaInvalidatingRule , { allow_destructive_changes : true } ) ;
259
- expect ( createResult ) . toBeTruthy ( ) ;
245
+ const ruleResponse = await addRuleToMongodbService ( services , syncService , schemaInvalidatingRule ) ;
246
+ expect ( ruleResponse . _id ) . toBeTruthy ( ) ;
260
247
} ) ;
261
248
262
249
it ( 'can use the allow_destructive_changes param to do a destructive rule change' , async ( ) => {
@@ -332,4 +319,22 @@ describe('Sync', () => {
332
319
expect ( updateResult . status ) . toBe ( 204 ) ;
333
320
} ) ;
334
321
} ) ;
322
+
323
+ describe ( 'progress' , ( ) => {
324
+ it ( 'should 404 if there is no active sync service' , async ( ) => {
325
+ let errorCode ;
326
+ try {
327
+ await sync . progress ( ) ;
328
+ } catch ( e ) {
329
+ errorCode = e . response . status ;
330
+ }
331
+ expect ( errorCode ) . toBe ( 404 ) ;
332
+ } ) ;
333
+
334
+ it ( 'should return a map of progress if there is an active sync service' , async ( ) => {
335
+ await createSampleMongodbSyncService ( services ) ;
336
+ const progressResponse = await sync . progress ( ) ;
337
+ expect ( progressResponse . progress ) . toEqual ( { } ) ;
338
+ } ) ;
339
+ } ) ;
335
340
} ) ;
0 commit comments