-
-
Save anonymous/d1171e6f5ff0693c55ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ npm test | |
> pouchdb-hoodie-api@ test /Users/gregor/JavaScripts/hood.ie/pouchdb-hoodie-api | |
> standard && npm run -s test:node | tap-spec | |
returns hoodie.store-inspired API | |
✓ exposes plugin initialisation method | |
✓ is object | |
✓ exposes db | |
creates store with custom EventEmitter instance | |
✓ (unnamed assert) | |
has "add" method | |
✓ has method | |
adds object to db | |
✓ resolves value | |
✓ resolves id | |
✓ resolves _rev | |
✓ puts doc | |
✓ puts value | |
adds object with id to db | |
✓ resolves id | |
✓ should be equal | |
fails for invalid object | |
✓ rejects error | |
✓ rejects with error 400 | |
fails for existing object | |
✓ rejects error | |
✓ rejects status | |
adds multiple objects to db | |
✓ resolves first value | |
✓ resolves first id | |
✓ resolves first _rev | |
✓ resolves second value | |
✓ resolves second id | |
✓ resolves second _rev | |
✓ resolves third w/ error | |
✓ puts docs | |
store.find exists | |
✓ has method | |
store.find(id) | |
✓ resolves value | |
store.find(object) | |
✓ resolves value | |
store.find fails for non-existing | |
✓ rejects error | |
✓ should be equal | |
✓ rejects error | |
✓ should be equal | |
store.find(array) | |
✓ resolves value | |
✓ resolves value | |
store.find(array) with non-existing | |
✓ resolves with value for existing | |
✓ resolves with 404 error for unknown | |
store.findAll exists | |
✓ has method | |
store.findAll() | |
✓ resolves empty array | |
✓ resolves all | |
✓ resolves all | |
store.findAll(filterFunction) | |
✓ resolves filtered | |
store.findAll() doesnt return _design docs | |
✓ resolves everything but _design/bar | |
✓ resolved doc isn't _design/bar | |
store.findOrAdd exists | |
✓ has method | |
store.findOrAdd(id, object) finds existing | |
✓ resolves with id | |
✓ resolves with old object | |
store.findOrAdd(id, object) adds new | |
✓ resolves with id | |
✓ resolves with new object | |
store.findOrAdd(id) fails if no object exists | |
✓ rejects with 412 error | |
store.findOrAdd(object) finds existing | |
✓ resolves with id | |
✓ resolves with old object | |
store.findOrAdd(object) adds new | |
✓ resolves with id | |
✓ resolves with new object | |
store.findOrAdd(object) fails if object has no id | |
✓ should be equal | |
store.findOrAdd([object1, object2]) | |
✓ object1 to be found | |
✓ object1 to be found | |
✓ object2 to be created | |
✓ object2 to be created | |
store.update() exists | |
✓ has method | |
store.update(id, changedProperties) | |
✓ (unnamed assert) | |
✓ revision is 2 | |
✓ passes properties | |
store.update(id) | |
✓ rejects error | |
store.update("unknown", changedProperties) | |
✓ rejects error | |
store.update(id, updateFunction) | |
✓ (unnamed assert) | |
✓ (unnamed assert) | |
✓ resolves properties | |
store.update(object) | |
✓ resolves with id | |
✓ resolves with new rev number | |
✓ resolves with properties | |
store.update(array) | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
store.update(array) with non-existent object | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
store.update(array) with invalid objects | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
store.update(array, changedProperties) | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
store.update(array, changedProperties) with non-existent objects | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
store.update(array, updateFunction) | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
✓ should be equal | |
store.updateOrAdd exists | |
✓ has method | |
store.updateOrAdd(id, object) updates existing | |
✓ resolves with id | |
✓ resolves with new object | |
store.updateOrAdd(id, object) adds new if non-existent | |
✓ resolves with id | |
✓ resolves with new object | |
store.updateOrAdd(id) fails with 400 error | |
✓ rejects with invalid request error | |
store.updateOrAdd(object) updates existing | |
✓ resolves with id | |
✓ resolves with new object | |
store.updateOrAdd(object) adds new if non-existent | |
✓ resolves with id | |
✓ resolves with new object | |
store.updateOrAdd(object) without object.id fails with 400 error | |
✓ rejects with invalid request error | |
store.updateOrAdd(array) updates existing, adds new | |
✓ object1 to be updated | |
✓ object1 to be updated | |
✓ object1 has revision 2 | |
✓ object2 to be created | |
✓ object2 to be created | |
has "updateAll" method | |
✓ has method | |
store.updateAll(changedProperties) | |
✓ resolves all | |
✓ resolves with id | |
✓ resolves with properties | |
✓ new revision | |
✓ new revision | |
✓ new revision | |
✓ old value remains | |
✓ updated object | |
✓ old value remains | |
✓ updated object | |
✓ old value remains | |
✓ updated object | |
store.updateAll(updateFunction) | |
✓ resolves all | |
✓ new revision | |
✓ new revision | |
✓ new revision | |
✓ old value remains | |
✓ updated object | |
✓ old value remains | |
✓ updated object | |
✓ old value remains | |
✓ updated object | |
fails store.updateAll() | |
✓ rejects error | |
store.updateAll(change) no objects | |
✓ reolves empty array | |
store.updateAll() doesnt update design docs | |
✓ resolves everything but _design/bar | |
✓ resolves with id | |
✓ check _design/bar for mutation | |
has "remove" method | |
✓ has method | |
removes existing by id | |
✓ resolves value | |
✓ rejects error | |
removes existing by object | |
✓ resolves value | |
✓ resolves value | |
✓ rejects with 404 error | |
fails for non-existing | |
✓ rejects error | |
✓ rejects error | |
store.remove(array) removes existing, returns error for non-existing | |
✓ resolves with value for existing | |
✓ resolves with value for existing | |
✓ resolves with revision 2 | |
✓ resolves with value for existing | |
✓ resolves with value for existing | |
✓ resolves with revision 2 | |
✓ resolves with 404 error for non-existing | |
store.removeAll exists | |
✓ has method | |
store.removeAll() | |
✓ resolves all | |
✓ resolves with properties | |
✓ new revision | |
✓ new revision | |
✓ new revision | |
✓ no objects can be found in store | |
store.removeAll(filterFunction) | |
✓ removes 4 objects | |
✓ does not remove other 3 objects | |
store.removeAll() | |
✓ resolves everything but _design/bar | |
✓ resolves with properties | |
✓ check _design/bar still exists | |
has "clear" method | |
✓ has method | |
removes existing db | |
✓ store 'clear' event was triggered | |
✓ doc removed after store.clear | |
has "on" method | |
✓ has method | |
has "one" method | |
✓ has method | |
has "off" method | |
✓ has method | |
store.on("add") with adding one | |
✓ triggers 1 add event | |
✓ event passes object | |
store.on("add") with adding two | |
✓ triggers 2 add event | |
✓ 1st event passes object | |
✓ 2nd event passes object | |
store.on("add") with one element added before registering event and one after | |
✓ triggers only 1 add event | |
✓ event passes object | |
store.on("add") with add & update | |
✓ triggers 1 add event | |
✓ event passes object | |
store.on("update") with updating one | |
✓ triggers 1 update event | |
✓ event passes object | |
store.on("update") with updating two | |
✓ triggers 2 update event | |
✓ 1st event passes object | |
✓ 2nd event passes object | |
store.on("update") with add & update | |
✓ triggers 1 update event | |
✓ event passes object | |
store.on("update") with update all | |
✓ triggers 2 update events | |
✓ 1st event passes object | |
✓ 2nd event passes object | |
store.on("remove") with removing one | |
✓ triggers 1 remove event | |
✓ event passes object | |
store.on("remove") with removing two | |
✓ triggers 2 remove events | |
✓ 1st event passes object | |
✓ 2nd event passes object | |
store.on("remove") with remove all | |
✓ triggers 2 remove events | |
✓ 1st event passes object | |
✓ 2nd event passes object | |
store.on("change") with adding one | |
✓ triggers 1 change event | |
✓ passes the event name | |
✓ event passes object | |
store.on("change") with updating one | |
✓ triggers 1 change event | |
✓ passes the event name | |
✓ event passes object | |
store.on("change") with removing one | |
✓ triggers 1 change event | |
✓ passes the event name | |
✓ event passes object | |
store.on("change") with adding one and updating it afterwards | |
✓ triggers 2 change events | |
✓ 1st event passes object | |
✓ 1st event passes the event name | |
✓ 2nd event passes object | |
✓ 2nd event passes the event name | |
store.off("add") with one add handler | |
✓ triggers no add event | |
store.off("add") with removing one of two add handlers | |
✓ triggers no add event on removed handler | |
store.off("update") with one update handler | |
✓ triggers no update event | |
store.off("remove") with one remove handler | |
✓ triggers no remove event | |
store.one("add") with adding one | |
✓ triggers 1 add event | |
✓ event passes object | |
store.one("add") with adding two | |
✓ triggers only add event | |
✓ event passes object | |
store.one("add") with add & update | |
✓ triggers 1 add event | |
✓ event passes object | |
store.one("add") with one element added before registering event and one after | |
✓ triggers only 1 add event | |
✓ event passes object | |
store.one("update") with updating one | |
✓ triggers 1 update event | |
✓ event passes object | |
store.one("update") with updating two | |
✓ triggers 1 update event | |
✓ event passes object | |
store.one("update") with add & update | |
✓ triggers 1 update event | |
✓ event passes object | |
store.one("update") with update all | |
✓ triggers 1 update event | |
✓ event passes object | |
store.one("remove") with removing one | |
✓ triggers 1 remove event | |
✓ event passes object | |
store.one("remove") with removing two | |
✓ triggers 1 remove event | |
✓ event passes object | |
store.one("remove") with remove all | |
✓ triggers 1 remove event | |
✓ event passes object | |
store.one("change") with adding one | |
✓ triggers 1 change event | |
✓ passes the event name | |
✓ event passes object | |
store.one("change") with adding two | |
✓ triggers 1 change event | |
✓ passes the event name | |
✓ event passes object | |
store.on returns store | |
✓ allows chaining | |
store.one returns store | |
✓ allows chaining | |
store.off returns store | |
✓ allows chaining | |
total: 255 | |
passing: 255 | |
duration: 2.2s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment