Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Commit

Permalink
add test converage to for peers service
Browse files Browse the repository at this point in the history
  • Loading branch information
reyraa committed Apr 18, 2017
1 parent 3f4bb75 commit 3119e34
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/test/services/peers/peers.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,53 @@ describe('Factory: $peers', () => {
});
});

describe('setPeerAPIObject', () => {
const RECIPIENT_ADDRESS = '5932438298200837883L';
const AMOUNT = '10';
const PASSPHRASE = 'robust swift grocery peasant forget share enable convince deputy road keep cheap';

beforeEach(() => {
$peers.setActive();
$peers.setPeerAPIObject({
node: 'localhost',
port: 4000,
testnet: true,
nethash: '198f2b61a8eb95fbeed58b8216780b68f697f26b849acf00c8c93bb9b24f783d',
});
});

it('sets getter/setter methods on $peers.active if it\'s called with correct configs', () => {
expect($peers.active.getStatusPromise).not.to.equal(undefined);
expect($peers.active.getAccountPromise).not.to.equal(undefined);
expect($peers.active.sendLSKPromise).not.to.equal(undefined);
expect($peers.active.listTransactionsPromise).not.to.equal(undefined);
});

it('creates $peers.active.getStatusPromise which returns a promise', () => {
const promise = $peers.active.getStatusPromise();
$rootScope.$apply();
expect(promise.then.constructor).to.be.equal(Function);
});

it('creates $peers.active.getAccountPromise which returns a promise', () => {
const promise = $peers.active.getAccountPromise(RECIPIENT_ADDRESS);
$rootScope.$apply();
expect(promise.then.constructor).to.be.equal(Function);
});

it('creates $peers.active.sendLSKPromise which returns a promise', () => {
const promise = $peers.active.sendLSKPromise(RECIPIENT_ADDRESS, AMOUNT, PASSPHRASE);
$rootScope.$apply();
expect(promise.then.constructor).to.be.equal(Function);
});

it('creates $peers.active.listTransactionsPromise which returns a promise', () => {
const promise = $peers.active.listTransactionsPromise(RECIPIENT_ADDRESS, AMOUNT);
$rootScope.$apply();
expect(promise.then.constructor).to.be.equal(Function);
});
});

describe('check()', () => {
let deffered;
let mock;
Expand Down

0 comments on commit 3119e34

Please sign in to comment.