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

Commit

Permalink
test(Wallet): repair
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjors committed May 10, 2017
1 parent 7753b18 commit 5b8ef28
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/wallet_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,19 +614,22 @@ describe('Wallet', () => {
expect(RNG.run).toHaveBeenCalled();
});

it('should call errorCallback if RNG throws', done => {
it('should call errorCallback if RNG throws', () => {
// E.g. because there was a network failure.
// This assumes BIP39.generateMnemonic does not rescue a throw
// inside the RNG

let observers =
{error () { done(); }};
{
error (e) {}
};

spyOn(observers, 'error').and.callThrough();

RNG.shouldThrow = true;
MyWallet.createNewWallet('[email protected]', '1234', 'My Wallet', 'en', 'usd', observers.success, observers.error);
expect(observers.error).toHaveBeenCalledWith('Connection failed');
expect(observers.error).toHaveBeenCalled();
expect(observers.error.calls.argsFor(0)[0].message).toEqual('Connection failed');

RNG.shouldThrow = false;
});
Expand Down

0 comments on commit 5b8ef28

Please sign in to comment.