Add more tests to controller
This commit is contained in:
parent
cf143898f9
commit
ac6dfc8035
3 changed files with 49 additions and 10 deletions
|
|
@ -144,11 +144,24 @@ describe('Unit: Rate Service', function() {
|
|||
should.exist(rateService.isAvailable);
|
||||
})
|
||||
);
|
||||
it('should be possible to ask for conversion',
|
||||
beforeEach(module(function($provide) {
|
||||
$provide.value('request', {
|
||||
'get': function(_, cb) {
|
||||
cb(null, null, [{name: 'lol currency', code: 'LOL', rate: 2}]);
|
||||
}
|
||||
});
|
||||
}));
|
||||
it('should be possible to ask for conversion from fiat',
|
||||
inject(function(rateService) {
|
||||
rateService.whenAvailable(function() {
|
||||
rateService.rates['LOL'] = 2;
|
||||
(1 * 1e8).should.equal(rateService.fromFiat(2, 'LOL'));
|
||||
(1).should.equal(rateService.fromFiat(2, 'LOL'));
|
||||
});
|
||||
})
|
||||
);
|
||||
it('should be possible to ask for conversion to fiat',
|
||||
inject(function(rateService) {
|
||||
rateService.whenAvailable(function() {
|
||||
(2).should.equal(rateService.toFiat(1e8, 'LOL'));
|
||||
});
|
||||
})
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue