diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2016-10-20 02:17:29 +0800 |
---|---|---|
committer | Kevin Serrano <kevgagser@gmail.com> | 2016-10-20 02:17:29 +0800 |
commit | 17506fe14f84680bc6b5421eff4c797154a513bd (patch) | |
tree | 339b1562b84402f7a609ec1d5ab5aea1a2cab76d /test/integration/lib | |
parent | 1481a3ef8e3352eb74fa11c4f578d15d84c76de7 (diff) | |
download | tangerine-wallet-browser-17506fe14f84680bc6b5421eff4c797154a513bd.tar.gz tangerine-wallet-browser-17506fe14f84680bc6b5421eff4c797154a513bd.tar.zst tangerine-wallet-browser-17506fe14f84680bc6b5421eff4c797154a513bd.zip |
Merge in crypto.
Diffstat (limited to 'test/integration/lib')
-rw-r--r-- | test/integration/lib/encryptor-test.js | 44 | ||||
-rw-r--r-- | test/integration/lib/first-time.js | 25 |
2 files changed, 69 insertions, 0 deletions
diff --git a/test/integration/lib/encryptor-test.js b/test/integration/lib/encryptor-test.js new file mode 100644 index 000000000..88ebed51b --- /dev/null +++ b/test/integration/lib/encryptor-test.js @@ -0,0 +1,44 @@ +var encryptor = require('../../../app/scripts/lib/encryptor') + +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 + + password = 'a sample passw0rd' + data = { foo: 'data to encrypt' } + + encryptor.encrypt(password, data) + .then(function(encryptedStr) { + assert.equal(typeof encryptedStr, 'string', 'returns a string') + return encryptor.decrypt(password, encryptedStr) + }) + .then(function (decryptedObj) { + assert.deepEqual(decryptedObj, data, 'decrypted what was encrypted') + done() + }) + .catch(function(reason) { + assert.ifError(reason, 'threw an error') + }) + +}) diff --git a/test/integration/lib/first-time.js b/test/integration/lib/first-time.js new file mode 100644 index 000000000..af9b94e24 --- /dev/null +++ b/test/integration/lib/first-time.js @@ -0,0 +1,25 @@ +QUnit.test('agree to terms', function (assert) { + var done = assert.async() + + // Select the mock app root + var app = $('iframe').contents().find('#app-content .mock-app-root') + + app.find('.markdown').prop('scrollTop', 100000000) + + wait().then(function() { + app.find('button').click() + }).then(function() { + return wait() + }).then(function() { + var title = app.find('h1').text() + assert.equal(title, 'MetaMask', 'title screen') + + var buttons = app.find('button') + assert.equal(buttons.length, 1, 'one button: create new vault') + + done() + }) + + // Wait for view to transition: +}) + |