Skip to content

Commit

Permalink
test(create): Ensure that duplicate name error covered
Browse files Browse the repository at this point in the history
Change store-test.js to ensure that the error due to attempted creation
of a store with a duplicate name is asserted on.
  • Loading branch information
minrwhite authored and gr2m committed Oct 25, 2016
1 parent 2a5b174 commit 6c24261
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/integration/api/store-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test('Store', function (group) {
})

group.test('create / open / destroy walkthrough', function (t) {
t.plan(7)
t.plan(8)

var Store = StoreAPIFactory(PouchDB)

Expand All @@ -52,6 +52,14 @@ test('Store', function (group) {
.then(function (name) {
t.is(name, 'dbname', 'Store.create resolves with name')

return Store.create('dbname')
})

.then(function () {
t.fail('Store.create should fail to create a store with name "dbname" twice')
}, function (error) {
t.is(error.status, 409, 'Store.create fails because database "dbname" already exists')

return Store.exists('dbname')
})

Expand Down

0 comments on commit 6c24261

Please sign in to comment.