diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-10-15 06:59:07 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-10-15 06:59:07 +0800 |
commit | 1c791c4d2e7f280b634a5fe1bb449d5d05c9db7c (patch) | |
tree | c285dbb78343a73d18ceb364cf9857420379ba2e /test | |
parent | c9cfcd5253b29ef7240e556a847f525c38729fa0 (diff) | |
download | tangerine-wallet-browser-1c791c4d2e7f280b634a5fe1bb449d5d05c9db7c.tar tangerine-wallet-browser-1c791c4d2e7f280b634a5fe1bb449d5d05c9db7c.tar.gz tangerine-wallet-browser-1c791c4d2e7f280b634a5fe1bb449d5d05c9db7c.tar.bz2 tangerine-wallet-browser-1c791c4d2e7f280b634a5fe1bb449d5d05c9db7c.tar.lz tangerine-wallet-browser-1c791c4d2e7f280b634a5fe1bb449d5d05c9db7c.tar.xz tangerine-wallet-browser-1c791c4d2e7f280b634a5fe1bb449d5d05c9db7c.tar.zst tangerine-wallet-browser-1c791c4d2e7f280b634a5fe1bb449d5d05c9db7c.zip |
Got basic encryptor working
Diffstat (limited to 'test')
-rw-r--r-- | test/integration/lib/encryptor-test.js | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/test/integration/lib/encryptor-test.js b/test/integration/lib/encryptor-test.js index f5cdea835..3297ad177 100644 --- a/test/integration/lib/encryptor-test.js +++ b/test/integration/lib/encryptor-test.js @@ -1,6 +1,27 @@ var encryptor = require('../../../app/scripts/lib/encryptor') -QUnit.test('encryptor', function(assert) { +QUnit.test('encryptor:serializeBufferForStorage', function (assert) { + assert.expect(1) + var buf = new Buffer(2) + buf[0] = 16 + buf[1] = 1 + + var output = encryptor.serializeBufferForStorage(buf) + + var expect = '0x1001' + assert.equal(expect, output) +}) + +QUnit.test('encryptor:serializeBufferFromStorage', function (assert) { + assert.expect(2) + var input = '0x1001' + var output = encryptor.serializeBufferFromStorage(input) + + assert.equal(output[0], 16) + assert.equal(output[1], 1) +}) + +QUnit.test('encryptor:encrypt & decrypt', function(assert) { var done = assert.async(); var password, data, encrypted @@ -9,19 +30,15 @@ QUnit.test('encryptor', function(assert) { encryptor.encrypt(password, data) .then(function(encryptedStr) { - assert.equal(typeof encryptedStr, 'string', 'returns a string') - - // Now try decrypting!jk - // return encryptor.decrypt(password, encryptedStr) - }) .then(function (decryptedObj) { - assert.equal(decryptedObj, data, 'decrypted what was encrypted') + assert.deepEqual(decryptedObj, data, 'decrypted what was encrypted') done() }) .catch(function(reason) { + debugger assert.ifError(reason, 'threw an error') }) |