Skip to content

Commit 42c93a9

Browse files
committed
test: wrong password
closes #24
1 parent 7feae75 commit 42c93a9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,17 @@ test('throws error when document has attachments', function (t) {
113113
t.ok(/Attachments cannot be encrypted/.test(e.message), 'throws error');
114114
})
115115
})
116+
test('wrong password', function (t) {
117+
t.plan(1);
118+
var dbName = 'nine';
119+
var db = new PouchDB(dbName, {db: memdown});
120+
db.crypto('correct')
121+
db.put({foo: 'bar'}, 'baz').then(function () {
122+
db.crypto('wrong')
123+
return db.get('baz');
124+
}).then(function (doc) {
125+
t.fail('retrieved document with bad password')
126+
}).catch(function (err) {
127+
t.equals(err.message, 'unable to authenticate', ' fails setting up invalid password.')
128+
})
129+
});

0 commit comments

Comments
 (0)