settings: fix angular test 2
This commit is contained in:
parent
6bdeaadb94
commit
258ae5c79c
1 changed files with 11 additions and 17 deletions
|
|
@ -34,12 +34,6 @@ describe("Unit: Controllers", function() {
|
||||||
alternativeIsoCode: 'LOL'
|
alternativeIsoCode: 'LOL'
|
||||||
};
|
};
|
||||||
|
|
||||||
it('Copay config should be binded', function() {
|
|
||||||
should.exist(config);
|
|
||||||
should.exist(config.unitToSatoshi);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
describe('More Controller', function() {
|
describe('More Controller', function() {
|
||||||
var ctrl;
|
var ctrl;
|
||||||
beforeEach(inject(function($controller, $rootScope) {
|
beforeEach(inject(function($controller, $rootScope) {
|
||||||
|
|
@ -224,35 +218,35 @@ describe("Unit: Controllers", function() {
|
||||||
sinon.assert.callCount(spy2, 0);
|
sinon.assert.callCount(spy2, 0);
|
||||||
sinon.assert.callCount(scope.loadTxs, 1);
|
sinon.assert.callCount(scope.loadTxs, 1);
|
||||||
spy.getCall(0).args[0].should.equal('mkfTyEk7tfgV611Z4ESwDDSZwhsZdbMpVy');
|
spy.getCall(0).args[0].should.equal('mkfTyEk7tfgV611Z4ESwDDSZwhsZdbMpVy');
|
||||||
spy.getCall(0).args[1].should.equal(1000 * config.unitToSatoshi);
|
spy.getCall(0).args[1].should.equal(1000 * scope.wallet.settings.unitToSatoshi);
|
||||||
(typeof spy.getCall(0).args[2]).should.equal('undefined');
|
(typeof spy.getCall(0).args[2]).should.equal('undefined');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should handle big values in 100 BTC', function() {
|
it('should handle big values in 100 BTC', function() {
|
||||||
var old = config.unitToSatoshi;
|
var old = scope.wallet.settings.unitToSatoshi;
|
||||||
config.unitToSatoshi = 100000000;;
|
scope.wallet.settings.unitToSatoshi = 100000000;;
|
||||||
sendForm.address.$setViewValue('mkfTyEk7tfgV611Z4ESwDDSZwhsZdbMpVy');
|
sendForm.address.$setViewValue('mkfTyEk7tfgV611Z4ESwDDSZwhsZdbMpVy');
|
||||||
sendForm.amount.$setViewValue(100);
|
sendForm.amount.$setViewValue(100);
|
||||||
var spy = sinon.spy(scope.wallet, 'createTx');
|
var spy = sinon.spy(scope.wallet, 'createTx');
|
||||||
scope.loadTxs = sinon.spy();
|
scope.loadTxs = sinon.spy();
|
||||||
scope.submitForm(sendForm);
|
scope.submitForm(sendForm);
|
||||||
spy.getCall(0).args[1].should.equal(100 * config.unitToSatoshi);
|
spy.getCall(0).args[1].should.equal(100 * scope.wallet.settings.unitToSatoshi);
|
||||||
config.unitToSatoshi = old;
|
scope.wallet.settings.unitToSatoshi = old;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should handle big values in 5000 BTC', function() {
|
it('should handle big values in 5000 BTC', inject(function($rootScope) {
|
||||||
var old = config.unitToSatoshi;
|
var old = $rootScope.wallet.settings.unitToSatoshi;
|
||||||
config.unitToSatoshi = 100000000;;
|
$rootScope.wallet.settings.unitToSatoshi = 100000000;;
|
||||||
sendForm.address.$setViewValue('mkfTyEk7tfgV611Z4ESwDDSZwhsZdbMpVy');
|
sendForm.address.$setViewValue('mkfTyEk7tfgV611Z4ESwDDSZwhsZdbMpVy');
|
||||||
sendForm.amount.$setViewValue(5000);
|
sendForm.amount.$setViewValue(5000);
|
||||||
var spy = sinon.spy(scope.wallet, 'createTx');
|
var spy = sinon.spy(scope.wallet, 'createTx');
|
||||||
scope.loadTxs = sinon.spy();
|
scope.loadTxs = sinon.spy();
|
||||||
scope.submitForm(sendForm);
|
scope.submitForm(sendForm);
|
||||||
spy.getCall(0).args[1].should.equal(5000 * config.unitToSatoshi);
|
spy.getCall(0).args[1].should.equal(5000 * $rootScope.wallet.settings.unitToSatoshi);
|
||||||
config.unitToSatoshi = old;
|
$rootScope.wallet.settings.unitToSatoshi = old;
|
||||||
});
|
}));
|
||||||
|
|
||||||
it('should convert bits amount to fiat', function(done) {
|
it('should convert bits amount to fiat', function(done) {
|
||||||
scope.rateService.whenAvailable(function() {
|
scope.rateService.whenAvailable(function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue