add negative decrypt test

feature/default_network_editable
Csaba Solya 7 years ago
parent cd05d77c3f
commit 8292dabed5
  1. 20
      test/unit/edge-encryptor-test.js

@ -76,5 +76,25 @@ describe('EdgeEncryptor', function () {
done(err)
})
})
it('cannot decrypt the encrypted data with wrong password.', function (done) {
edgeEncryptor.encrypt(password, data)
.then(function (encryptedData) {
edgeEncryptor.decrypt('wrong password', encryptedData)
.then(function (decryptedData) {
assert.fail('could decrypt with wrong password')
done()
})
.catch(function (err) {
assert.ok(err instanceof Error)
assert.equal(err.message, 'Incorrect password')
done()
})
})
.catch(function (err) {
done(err)
})
})
})
})

Loading…
Cancel
Save