diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-06-16 05:58:17 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-06-16 05:58:17 +0800 |
commit | 6b0a99a09ac9efce4cf54d84e9362ac3b6b35a3d (patch) | |
tree | 1a768ab5a5a0f86b275bee03e2e437b9bbe2180a /test | |
parent | ae3993b6d752207115a4767247caddbb42c197e3 (diff) | |
download | tangerine-wallet-browser-6b0a99a09ac9efce4cf54d84e9362ac3b6b35a3d.tar tangerine-wallet-browser-6b0a99a09ac9efce4cf54d84e9362ac3b6b35a3d.tar.gz tangerine-wallet-browser-6b0a99a09ac9efce4cf54d84e9362ac3b6b35a3d.tar.bz2 tangerine-wallet-browser-6b0a99a09ac9efce4cf54d84e9362ac3b6b35a3d.tar.lz tangerine-wallet-browser-6b0a99a09ac9efce4cf54d84e9362ac3b6b35a3d.tar.xz tangerine-wallet-browser-6b0a99a09ac9efce4cf54d84e9362ac3b6b35a3d.tar.zst tangerine-wallet-browser-6b0a99a09ac9efce4cf54d84e9362ac3b6b35a3d.zip |
Began adding signMsg unit test
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/id-management-test.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/unit/id-management-test.js b/test/unit/id-management-test.js new file mode 100644 index 000000000..ca1f0ffaa --- /dev/null +++ b/test/unit/id-management-test.js @@ -0,0 +1,31 @@ +var assert = require('assert') +var IdManagement = require('../../app/scripts/lib/id-management') +var sinon = require('sinon') + +describe('IdManagement', function() { + + beforeEach(function() { + // sinon allows stubbing methods that are easily verified + this.sinon = sinon.sandbox.create() + window.localStorage = {} // Hacking localStorage support into JSDom + }) + + afterEach(function() { + // sinon requires cleanup otherwise it will overwrite context + this.sinon.restore() + }) + + describe('#signMsg', function () { + const address = '0x926cD0393816429a580037475ec23eD65fDC893B' + const message = '0x0987654321abcdef' + const privateKey = '0xd291f7aa01b94941b446f260bca42c0752762571428ad4ed6239613c66365cf4' + const expectedResult = 'foo' + + const idManagement = new IdManagement() + const exportKeyStub = sinon.stub(idManagement, 'exportPrivateKey', () => privateKey) + + const result = idManagement.signMsg(address, message) + console.log(result) + assert.equal(result, expectedResult) + }) +}) |