aboutsummaryrefslogtreecommitdiffstats
path: root/test/integration
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-11-04 07:06:57 +0800
committerDan Finlay <dan@danfinlay.com>2016-11-04 07:14:37 +0800
commitba7d6b437f2e03a9e2bb46dcda846cee1f816ce1 (patch)
tree001b0fe49f3d25c392e5d65ebb17973cabc1c920 /test/integration
parent2afc06287dfd1a87bd247234c9a04b92a8394cac (diff)
downloadtangerine-wallet-browser-ba7d6b437f2e03a9e2bb46dcda846cee1f816ce1.tar
tangerine-wallet-browser-ba7d6b437f2e03a9e2bb46dcda846cee1f816ce1.tar.gz
tangerine-wallet-browser-ba7d6b437f2e03a9e2bb46dcda846cee1f816ce1.tar.bz2
tangerine-wallet-browser-ba7d6b437f2e03a9e2bb46dcda846cee1f816ce1.tar.lz
tangerine-wallet-browser-ba7d6b437f2e03a9e2bb46dcda846cee1f816ce1.tar.xz
tangerine-wallet-browser-ba7d6b437f2e03a9e2bb46dcda846cee1f816ce1.tar.zst
tangerine-wallet-browser-ba7d6b437f2e03a9e2bb46dcda846cee1f816ce1.zip
Fix password validation and persistence issue
Was wiping the vault on each successful password attempt... :P
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/lib/encryptor-test.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/integration/lib/encryptor-test.js b/test/integration/lib/encryptor-test.js
index 1c8a7605a..d42608152 100644
--- a/test/integration/lib/encryptor-test.js
+++ b/test/integration/lib/encryptor-test.js
@@ -43,3 +43,25 @@ QUnit.test('encryptor:encrypt & decrypt', function(assert) {
})
})
+
+QUnit.test('encryptor:encrypt & decrypt with wrong password', function(assert) {
+ var done = assert.async();
+ var password, data, encrypted, wrongPassword
+
+ password = 'a sample passw0rd'
+ wrongPassword = 'a wrong password'
+ data = { foo: 'data to encrypt' }
+
+ encryptor.encrypt(password, data)
+ .then(function(encryptedStr) {
+ assert.equal(typeof encryptedStr, 'string', 'returns a string')
+ return encryptor.decrypt(wrongPassword, encryptedStr)
+ })
+ .then(function (decryptedObj) {
+ assert.equal(!decryptedObj, true, 'Wrong password should not decrypt')
+ done()
+ })
+ .catch(function(reason) {
+ done()
+ })
+})