This commit is contained in:
Ivan Socolsky 2014-09-12 10:40:47 -03:00
commit 81a73e6f2a
5 changed files with 51 additions and 12 deletions

View file

@ -5,9 +5,11 @@
var sinon = require('sinon');
// Replace saveAs plugin
saveAsLastCall = null;
saveAs = function(o) {
saveAsLastCall = o;
saveAs = function(blob, filename) {
saveAsLastCall = {
blob: blob,
filename: filename
};
};
var startServer = require('../../mocks/FakePayProServer');
@ -35,6 +37,11 @@ describe("Unit: Controllers", function() {
};
describe('More Controller', function() {
it('Copay config should be binded', function() {
should.exist(config);
should.exist(config.unitToSatoshi);
});
var ctrl;
beforeEach(inject(function($controller, $rootScope) {
scope = $rootScope.$new();
@ -44,14 +51,22 @@ describe("Unit: Controllers", function() {
$scope: scope,
$modal: {},
});
saveAsLastCall = null;
}));
it('Backup controller #download', function() {
scope.wallet.setEnc('1234567');
expect(saveAsLastCall).equal(null);
scope.downloadBackup();
expect(saveAsLastCall.size).equal(7);
expect(saveAsLastCall.type).equal('text/plain;charset=utf-8');
expect(saveAsLastCall.blob.size).equal(7);
expect(saveAsLastCall.blob.type).equal('text/plain;charset=utf-8');
});
it('Backup controller should name backup correctly', function() {
scope.wallet.setEnc('1234567');
expect(saveAsLastCall).equal(null);
scope.downloadBackup();
expect(saveAsLastCall.filename).equal('myNickname-myTESTwullet-testID-keybackup.json.aes');
});
it('Backup controller #delete', function() {