hoodiehq/pouchdb-hoodie-sync

add tests for filtered replications that do not match any object

Closed this issue · 0 comments

gr2m commented

something like this, for push / pull / sync

test('api.push("inexistent")', function (t) {
  t.plan(1)
  var db = dbFactory('hoodieDB-inexistent')
  var PouchDB = db.constructor
  var remoteName = PouchDB.utils.uuid(10)
  var api = db.hoodieSync({remote: remoteName})

  db.put({_id: 'test1', foo1: 'bar1'})

  .then(function () {
    api.push('inexistent')
    .then(function (pushedObjects) {
      t.equal(pushedObjects.length, 0, 'pushedObjects length is 0')
    })
  })
})