From 959bb8a11a20e161d6a9f195781f07f7558c6a36 Mon Sep 17 00:00:00 2001 From: Justin Tormey Date: Thu, 7 Apr 2016 15:00:11 -0400 Subject: [PATCH] test(Address): test that signMessage outputs base64 and tries uncomp format --- tests/address_spec.js.coffee | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/address_spec.js.coffee b/tests/address_spec.js.coffee index 632db6a7b..79aa32269 100644 --- a/tests/address_spec.js.coffee +++ b/tests/address_spec.js.coffee @@ -263,6 +263,18 @@ describe "Address", -> a._priv = null expect(a.signMessage.bind(a, 'message')).toThrow('Private key needed for message signing') + it 'should convert to base64', -> + spy = jasmine.createSpy('toString') + spyOn(Bitcoin.message, 'sign').and.returnValue({ toString: spy }) + a.signMessage('message') + expect(spy).toHaveBeenCalledWith('base64') + + it 'should try compressed format if the address does not match', -> + keyPair = { getAddress: (-> 'uncomp_address'), compressed: true } + spyOn(Helpers, 'privateKeyStringToKey').and.returnValue(keyPair) + a.signMessage('message') + expect(keyPair.compressed).toEqual(false) + describe ".encrypt", -> it 'should fail when encryption fails', ->