Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
test(Address): test that signMessage outputs base64 and tries uncomp …
Browse files Browse the repository at this point in the history
…format
  • Loading branch information
jtormey committed Apr 7, 2016
1 parent 06b6979 commit 959bb8a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/address_spec.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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', ->
Expand Down

0 comments on commit 959bb8a

Please sign in to comment.