Fixes: tests. Added karma and mocha tests.
This commit is contained in:
parent
801e746d11
commit
8ad1fa7b02
7 changed files with 40 additions and 9 deletions
|
|
@ -27,6 +27,18 @@ FakeStorage.prototype.getLastOpened = function() {
|
|||
return this.storage['lastOpened'];
|
||||
};
|
||||
|
||||
FakeStorage.prototype.setIsOpen = function(id) {
|
||||
this.storage[id + '::isOpen'] = true;
|
||||
}
|
||||
|
||||
FakeStorage.prototype.getIsOpen = function(id) {
|
||||
return this.storage[id + '::isOpen'];
|
||||
}
|
||||
|
||||
FakeStorage.prototype.removeIsOpen = function(id) {
|
||||
delete this[id + '::isOpen'];
|
||||
}
|
||||
|
||||
FakeStorage.prototype.removeGlobal = function(id) {
|
||||
delete this.storage[id];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ var FakeWallet = function() {
|
|||
this.safeBalance = 1000;
|
||||
this.totalCopayers = 2;
|
||||
this.requiredCopayers = 2;
|
||||
this.isLocked = false;
|
||||
this.balanceByAddr = {
|
||||
'1CjPR7Z5ZSyWk6WtXvSFgkptmpoi4UM9BC': 1000
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1022,6 +1022,14 @@ describe('Wallet model', function() {
|
|||
w.netStart();
|
||||
w.network.start.getCall(0).args[0].privkey.length.should.equal(64);
|
||||
});
|
||||
|
||||
it('should check if wallet is already opened', function() {
|
||||
var w = createW();
|
||||
w._checkLocked();
|
||||
w.isLocked.should.equal(false);
|
||||
w._checkLocked();
|
||||
w.isLocked.should.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#forceNetwork in config', function() {
|
||||
|
|
|
|||
|
|
@ -288,8 +288,10 @@ describe("Unit: Controllers", function() {
|
|||
describe("Unit: Sidebar Controller", function() {
|
||||
var rootScope;
|
||||
beforeEach(inject(function($controller, $rootScope) {
|
||||
rootScope = $rootScope;
|
||||
scope = $rootScope.$new();
|
||||
rootScope = $rootScope;
|
||||
rootScope.wallet = new FakeWallet(config);
|
||||
|
||||
headerCtrl = $controller('SidebarController', {
|
||||
$scope: scope,
|
||||
});
|
||||
|
|
@ -301,6 +303,11 @@ describe("Unit: Controllers", function() {
|
|||
expect(array.length).equal(n);
|
||||
});
|
||||
|
||||
it('should ignore if wallet is locked', function() {
|
||||
scope.ignoreLocked();
|
||||
expect(rootScope.wallet.isLocked).equal(false);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('Send Controller', function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue