mirror of https://github.com/BTCPrivate/copay.git
add tests
This commit is contained in:
parent
eeb621b601
commit
4b81bc1fdb
|
@ -3,6 +3,7 @@ var FakeWallet = function(){
|
|||
this.balance=10000;
|
||||
this.safeBalance=1000;
|
||||
this.balanceByAddr={'1CjPR7Z5ZSyWk6WtXvSFgkptmpoi4UM9BC': 1000};
|
||||
this.name = 'myTESTwullet';
|
||||
};
|
||||
|
||||
FakeWallet.prototype.set = function(balance, safeBalance, balanceByAddr){
|
||||
|
@ -28,6 +29,11 @@ FakeWallet.prototype.getBalance=function(cb){
|
|||
return cb(null, this.balance, this.balanceByAddr, this.safeBalance);
|
||||
};
|
||||
|
||||
|
||||
FakeWallet.prototype.toEncryptedObj = function() {
|
||||
return 'SUPERENCRYPTEDSICRITSTUFF';
|
||||
};
|
||||
|
||||
// This mock is meant for karma, module.exports is not necesary.
|
||||
try {
|
||||
module.exports = require('soop')(FakeWallet);
|
||||
|
|
|
@ -87,3 +87,24 @@ describe("Unit: controllerUtils", function() {
|
|||
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe("Unit: Backup Service", function() {
|
||||
var sinon = require('../sinon');
|
||||
beforeEach(angular.mock.module('copayApp.services'));
|
||||
it('should contain a backup service', inject(function(backupService) {
|
||||
expect(backupService).not.to.equal(null);
|
||||
}));
|
||||
it('should backup in file', inject(function(backupService) {
|
||||
var mock = sinon.mock(window);
|
||||
var expectation = mock.expects('saveAs');
|
||||
backupService.download(new FakeWallet());
|
||||
expectation.once();
|
||||
}));
|
||||
it('should backup by email', inject(function(backupService) {
|
||||
var mock = sinon.mock(window);
|
||||
var expectation = mock.expects('open');
|
||||
backupService.sendEmail('fake@test.com', new FakeWallet());
|
||||
expectation.once();
|
||||
}));
|
||||
});
|
||||
|
|
|
@ -80,6 +80,11 @@ var createBundle = function(opts) {
|
|||
expose: '../js/models/core/Passphrase'
|
||||
});
|
||||
|
||||
if (opts.dontminify) {
|
||||
b.require('sinon', {
|
||||
expose: '../sinon'
|
||||
});
|
||||
}
|
||||
if (!opts.dontminify) {
|
||||
b.transform({
|
||||
global: true
|
||||
|
|
Loading…
Reference in New Issue