fix tests fixtures

This commit is contained in:
Matias Alejo Garcia 2016-06-08 08:30:57 -03:00
parent 7d401aa8c4
commit 6cb1370d6e
No known key found for this signature in database
GPG Key ID: 02470DB551277AB3
3 changed files with 62 additions and 21 deletions

View File

@ -5,18 +5,53 @@ describe('createController', function() {
'1eda3e702196b8d5d82fae129249bc79f0d5be2f5309a4e39855e7eb4ad31428': {},
'31f5deeef4cf7fd8fc67297179232e8e4590532960454ad958009132fef3daae': {},
// createWallet 1-1
//
'b665ad8991c67f8f7e8ffb7e86c3b930fd3ff56c68eb6fd441bf374559cfe59c': {
"walletId": "b2643a0d-7d58-413a-b757-017e086a9c3d",
"walletId": "63d910e8-3e1b-4aac-97e9-aa0299a74c2c"
},
'b87aa44e3ff1c3606e38f6e42dce31ddc848a3e1c9b161e541732cbcf34a0103': {
"walletId": "b2643a0d-7d58-413a-b757-017e086a9c3d",
"name": "{\"iv\":\"BZQVWAP6d1e4G8Fq1rQKbA==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"wwZd+2LQgYR6cA==\"}",
"xPubKey": "xpub6DRjAgkh3vGTWDcEmDp4TPwy48Nu8yrp6swCEdCCLL615CgnZon7r3vXYr8LYibMLJh5DriGSito1FRBwVoBkjD1ZWG4dmgiC935wLj3nQC",
"requestPubKey": "02befcc7499abcecf9608bb05e665f374434a89ca0c4e9baeab7dd28c027143458",
"customData": "{\"iv\":\"BZQVWAP6d1e4G8Fq1rQKbA==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"1Wjf2KvFkd5k0ypiiSNkSVXk7zdBOiTeCrwzPBI7fMQ/VqXUzrSB6gMGs9jISr+MvCaL1GJIXjaMnlQZNMR0lx/Pd1c6R/nKGBdHjKh0mlI=\"}",
"copayerSignature": "3044022042e069126a42f1b9b498c315a825ef4fc9f4214156442651e4fef5c7678245e702205936045d7b22baa36ba36ef827cc3e5d542d57d9a1afb3a54080d12f0b95c67e"
'd5cc6adebc752c154998f1c96af2b24e21e52dbd7c07008c333af03b905ffb85': {
"copayerId": "a9dcee10fe9c611300e6c7926ece20780f89b9a98baaa342928038b5503ed929",
"wallet": {
"version": "1.0.0",
"createdOn": 1465385318,
"id": "63d910e8-3e1b-4aac-97e9-aa0299a74c2c",
"name": "{\"iv\":\"BZQVWAP6d1e4G8Fq1rQKbA==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"70OA+k4+xTPxim+QSdDtA5/Cf055\"}",
"m": 1,
"n": 1,
"singleAddress": false,
"status": "complete",
"publicKeyRing": [{
"xPubKey": "xpub6DRjAgkh3vGTWDcEmDp4TPwy48Nu8yrp6swCEdCCLL615CgnZon7r3vXYr8LYibMLJh5DriGSito1FRBwVoBkjD1ZWG4dmgiC935wLj3nQC",
"requestPubKey": "02befcc7499abcecf9608bb05e665f374434a89ca0c4e9baeab7dd28c027143458"
}],
"copayers": [{
"version": 2,
"createdOn": 1465385318,
"xPubKey": "xpub6DRjAgkh3vGTWDcEmDp4TPwy48Nu8yrp6swCEdCCLL615CgnZon7r3vXYr8LYibMLJh5DriGSito1FRBwVoBkjD1ZWG4dmgiC935wLj3nQC",
"id": "a9dcee10fe9c611300e6c7926ece20780f89b9a98baaa342928038b5503ed929",
"name": "{\"iv\":\"BZQVWAP6d1e4G8Fq1rQKbA==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"wwZd+2LQgYR6cA==\"}",
"requestPubKey": "02befcc7499abcecf9608bb05e665f374434a89ca0c4e9baeab7dd28c027143458",
"signature": "3044022042e069126a42f1b9b498c315a825ef4fc9f4214156442651e4fef5c7678245e702205936045d7b22baa36ba36ef827cc3e5d542d57d9a1afb3a54080d12f0b95c67e",
"requestPubKeys": [{
"key": "02befcc7499abcecf9608bb05e665f374434a89ca0c4e9baeab7dd28c027143458",
"signature": "3044022042e069126a42f1b9b498c315a825ef4fc9f4214156442651e4fef5c7678245e702205936045d7b22baa36ba36ef827cc3e5d542d57d9a1afb3a54080d12f0b95c67e"
}],
"customData": "{\"iv\":\"BZQVWAP6d1e4G8Fq1rQKbA==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"1Wjf2KvFkd5k0ypiiSNkSVXk7zdBOiTeCrwzPBI7fMQ/VqXUzrSB6gMGs9jISr+MvCaL1GJIXjaMnlQZNMR0lx/Pd1c6R/nKGBdHjKh0mlI=\"}"
}],
"pubKey": "026d95bb5cc2a30c19e22379ae78b4757aaa2dd0ccbd15a1db054fb50cb98ed361",
"network": "livenet",
"derivationStrategy": "BIP44",
"addressType": "P2PKH",
"addressManager": {
"version": 2,
"derivationStrategy": "BIP44",
"receiveAddressIndex": 0,
"changeAddressIndex": 0,
"copayerIndex": 2147483647
},
"scanStatus": null
}
},
//createWallet 2-2
'5a1d11ebc2a011f018b049de6b5c6b990cdc8e280644103f95a995321dbf0248': {
"walletId": "2f50f598-7550-4e54-8032-15aa892309fb"
@ -100,16 +135,16 @@ describe('createController', function() {
should.not.exist(ctrl.error);
mocks.go.walletHome.calledOnce.should.equal(true);
//
// check resulting profile
storageService.getProfile(function(err, profile) {
should.not.exist(err);
var c = profile.credentials[0];
c.network.should.equal('livenet');
// from test vectors from https://dcpos.github.io/bip39/
c.xPrivKey.should.equal('xprv9s21ZrQH143K2x4gnzRB1eZDq92Uuvy9CXbvgQGdvykXZ9mkkot6LBjzDpgaAfvzkuxJe9JKJXQ38VoPutxvACA5MsyoBs5UyQ4HZKGshGs');
done();
});
storageService.getProfile(function(err, profile) {
should.not.exist(err);
var c = profile.credentials[0];
c.network.should.equal('livenet');
// from test vectors from https://dcpos.github.io/bip39/
c.xPrivKey.should.equal('xprv9s21ZrQH143K2x4gnzRB1eZDq92Uuvy9CXbvgQGdvykXZ9mkkot6LBjzDpgaAfvzkuxJe9JKJXQ38VoPutxvACA5MsyoBs5UyQ4HZKGshGs');
done();
});
});

View File

@ -64,8 +64,8 @@ mocks.$document = {
mocks.init = function(fixtures, controllerName, opts, done) {
console.log(' * Mock init()');
opts = opts || {};
should.exist(controllerName, 'Provide the name of the Controller to mocks.init()');
should.exist(controllerName, 'Provide the name of the Controller to mocks.init()');
mocks.go = {};
mocks.go.walletHome = sinon.stub();
mocks.go.path = sinon.stub();
@ -86,6 +86,7 @@ mocks.init = function(fixtures, controllerName, opts, done) {
module('gettext');
module('stateMock');
module('bwcModule', function($provide) {
console.log(' * bwcService decorator');
$provide.decorator('bwcService', function($delegate, lodash) {
var getClient = $delegate.getClient;
@ -182,8 +183,12 @@ mocks.init = function(fixtures, controllerName, opts, done) {
rate: 452.92
});
$httpBackend.whenGET(/views.*/).respond(200, '');
_configService_.get(function() {
function startController() {
console.log(' * starting Controller:', controllerName);
ctrl = $controller(controllerName, {
$scope: scope,
$modal: mocks.modal,
@ -216,6 +221,7 @@ mocks.init = function(fixtures, controllerName, opts, done) {
done();
});
} else {
_profileService_.create({
noWallet: true
}, function(err) {
@ -226,6 +232,7 @@ mocks.init = function(fixtures, controllerName, opts, done) {
_profileService_.setDisclaimerAccepted(function() {
if (!opts.initController)
startController();
done();
});
});

View File

@ -18,7 +18,7 @@ module.exports = function(config) {
'bower_components/qrcode-generator/js/qrcode.js',
'bower_components/qrcode-decoder-js/lib/qrcode-decoder.js',
'bower_components/moment/min/moment-with-locales.js',
'bower_components/angular/angular.js',
'bower_components/ionic/release/js/ionic.bundle.min.js',
'bower_components/angular-ui-router/release/angular-ui-router.js',
'bower_components/angular-foundation/mm-foundation-tpls.js',
'bower_components/angular-moment/angular-moment.js',
@ -28,7 +28,6 @@ module.exports = function(config) {
'bower_components/angular-sanitize/angular-sanitize.js',
'bower_components/ng-csv/build/ng-csv.js',
'bower_components/angular-mocks/angular-mocks.js',
'bower_components/ionic/release/js/ionic.bundle.min.js',
'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js',
'src/js/**/*.js',
'test/helpers.js',