Display fiat on Network Fees popup. Display subcent amounts as '< 0.01'.
This commit is contained in:
parent
a6d2799510
commit
a186e4d04f
3 changed files with 96 additions and 6 deletions
71
src/js/services/txFormatService.spec.js
Normal file
71
src/js/services/txFormatService.spec.js
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
describe('txFormatService', function(){
|
||||
var configServiceMock,
|
||||
rateServiceMock,
|
||||
txFormatService;
|
||||
|
||||
beforeEach(function(){
|
||||
module('ngLodash');
|
||||
module('bwcModule');
|
||||
module('copayApp.filters');
|
||||
module('copayApp.services');
|
||||
|
||||
configServiceMock = {
|
||||
getSync: jasmine.createSpy()
|
||||
};
|
||||
|
||||
rateServiceMock = {
|
||||
isAvailable: jasmine.createSpy(),
|
||||
toFiat: jasmine.createSpy()
|
||||
};
|
||||
|
||||
module(function($provide) {
|
||||
$provide.value('configService', configServiceMock);
|
||||
//$provide.value('$log', log); // Handy for debugging test failures
|
||||
$provide.value('rateService', rateServiceMock);
|
||||
});
|
||||
|
||||
inject(function($injector){
|
||||
txFormatService = $injector.get('txFormatService');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it('formatAlternativeStr 0.49 cents.', function() {
|
||||
|
||||
configServiceMock.getSync.and.returnValue({
|
||||
wallet: {
|
||||
settings: {
|
||||
alternativeIsoCode: 'USD'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
rateServiceMock.isAvailable.and.returnValue(true);
|
||||
rateServiceMock.toFiat.and.returnValue(0.00499);
|
||||
|
||||
var formatted = txFormatService.formatAlternativeStr('bch', 123);
|
||||
|
||||
expect(formatted).toBe('< 0.01 USD');
|
||||
//expect(formatted).toBe('0.00 USD');
|
||||
|
||||
});
|
||||
|
||||
it('formatAlternativeStr 0.5 cents.', function() {
|
||||
|
||||
configServiceMock.getSync.and.returnValue({
|
||||
wallet: {
|
||||
settings: {
|
||||
alternativeIsoCode: 'USD'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
rateServiceMock.isAvailable.and.returnValue(true);
|
||||
rateServiceMock.toFiat.and.returnValue(0.005);
|
||||
|
||||
var formatted = txFormatService.formatAlternativeStr('bch', 123);
|
||||
|
||||
expect(formatted).toBe('0.01 USD');
|
||||
});
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue