From 84bc38e6b684886e8fff29157115a1efa9a218c3 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 14 Oct 2016 16:41:35 -0300 Subject: [PATCH] temporary remove tests --- package.json | 11 - test/controllers/backup.test.js | 49 - test/controllers/copayers.test.js | 18 - test/controllers/create.test.js | 185 --- test/controllers/disclaimer.test.js | 82 -- test/controllers/import.test.js | 112 -- test/controllers/index.test.js | 71 - test/controllers/join.test.js | 150 -- test/controllers/preferencesHistory.test.js | 37 - test/controllers/walletHome.test.js | 19 - test/fixtures.js | 1405 ------------------- test/helpers.js | 262 ---- test/karma.conf.js | 115 -- test/old/controllersSpec.js | 1112 --------------- test/old/directivesSpec.js | 250 ---- test/old/filtersSpec.js | 168 --- test/old/servicesSpec.js | 215 --- test/old/sidebar.test.js | 11 - test/profiles.js | 65 - test/walletService.test.js | 24 - 20 files changed, 4361 deletions(-) delete mode 100644 test/controllers/backup.test.js delete mode 100644 test/controllers/copayers.test.js delete mode 100644 test/controllers/create.test.js delete mode 100644 test/controllers/disclaimer.test.js delete mode 100644 test/controllers/import.test.js delete mode 100644 test/controllers/index.test.js delete mode 100644 test/controllers/join.test.js delete mode 100644 test/controllers/preferencesHistory.test.js delete mode 100644 test/controllers/walletHome.test.js delete mode 100644 test/fixtures.js delete mode 100644 test/helpers.js delete mode 100644 test/karma.conf.js delete mode 100644 test/old/controllersSpec.js delete mode 100644 test/old/directivesSpec.js delete mode 100644 test/old/filtersSpec.js delete mode 100644 test/old/servicesSpec.js delete mode 100644 test/old/sidebar.test.js delete mode 100644 test/profiles.js delete mode 100644 test/walletService.test.js diff --git a/package.json b/package.json index fd30b3f2e..bc181d68c 100644 --- a/package.json +++ b/package.json @@ -70,19 +70,8 @@ "grunt-contrib-uglify": "^2.0.0", "grunt-contrib-watch": "^1.0.0", "grunt-exec": "^1.0.0", - "grunt-karma": "^2.0.0", - "grunt-karma-coveralls": "^2.5.4", "grunt-nw-builder": "^2.0.3", "grunt-sass": "^1.2.0", - "karma": "^0.13.22", - "karma-chai": "^0.1.0", - "karma-chrome-launcher": "^1.0.1", - "karma-cli": "^1.0.0", - "karma-coverage": "^1.0.0", - "karma-mocha": "^1.0.1", - "karma-mocha-reporter": "^2.0.3", - "karma-phantomjs-launcher": "^1.0.0", - "karma-sinon": "^1.0.5", "load-grunt-tasks": "^3.5.0", "mocha": "^2.4.5", "phantomjs-prebuilt": "^2.1.7", diff --git a/test/controllers/backup.test.js b/test/controllers/backup.test.js deleted file mode 100644 index 29c2a3f71..000000000 --- a/test/controllers/backup.test.js +++ /dev/null @@ -1,49 +0,0 @@ -describe('Backup Controller', function() { - - var walletService; - - describe('Incomplete wallet', function() { - beforeEach(function(done) { - mocks.init(FIXTURES, 'backupController', { - loadProfile: PROFILE.incomplete2of2, - }, done); - }); - - afterEach(function(done) { - mocks.clear({}, done); - }); - - it('should be defined', function() { - should.exist(ctrl); - }); - - it('should set the mnemonic incomplete wallets', function(done) { - scope.initFlow(); - should.exist(scope.mnemonicWords); - scope.mnemonicWords.should.deep.equal('dizzy cycle skirt decrease exotic fork sure mixture hair vapor copper hero'.split(' ')); - done(); - }); - }); - - describe('Complete 1-1 wallet', function() { - beforeEach(function(done) { - mocks.init(FIXTURES, 'backupController', { - loadProfile: PROFILE.testnet1of1, - }, done); - }); - - afterEach(function(done) { - mocks.clear({}, done); - }); - - it('should not set the mnemonic for complete wallets', function() { - scope.initFlow(); - scope.mnemonicWords.should.deep.equal('cheese where alarm job conduct donkey license pave congress pepper fence current'.split(' ')); - }); - - it('should set main wallet info', function(done) { - scope.walletName.should.equal('kk'); - done(); - }); - }); -}); diff --git a/test/controllers/copayers.test.js b/test/controllers/copayers.test.js deleted file mode 100644 index 40cbbea57..000000000 --- a/test/controllers/copayers.test.js +++ /dev/null @@ -1,18 +0,0 @@ -describe('copayers', function() { - - var walletService; - var fixtures = {}; - - - beforeEach(function(done){ - mocks.init(fixtures, 'copayersController', {}, done); - }) - - afterEach(function(done){ - mocks.clear({}, done); - }) - - it('should be defined', function() { - should.exist(ctrl); - }); -}); diff --git a/test/controllers/create.test.js b/test/controllers/create.test.js deleted file mode 100644 index 8010fde85..000000000 --- a/test/controllers/create.test.js +++ /dev/null @@ -1,185 +0,0 @@ -describe('createController', function() { - var fixtures = { - - // Store prefs - '1eda3e702196b8d5d82fae129249bc79f0d5be2f5309a4e39855e7eb4ad31428': {}, - '31f5deeef4cf7fd8fc67297179232e8e4590532960454ad958009132fef3daae': {}, - // createWallet 1-1 - // - 'b665ad8991c67f8f7e8ffb7e86c3b930fd3ff56c68eb6fd441bf374559cfe59c': { - "walletId": "63d910e8-3e1b-4aac-97e9-aa0299a74c2c" - }, - '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" - }, - // join - '58f2f3a6f11cd7dee9a75e026e3ba570c09b952bfea05f596fdb48e6ea323f21': { - "copayerId": "3d4eb9b439eee1b2b73cf792eda52e420f4665109c7234a50cf3cdbf296ea8fb", - "wallet": { - "version": "1.0.0", - "createdOn": 1465347188, - "id": "2f50f598-7550-4e54-8032-15aa892309fb", - "name": "{\"iv\":\"BZQVWAP6d1e4G8Fq1rQKbA==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"70OA+k4+xTPxim+QSdDtA5/Cf055\"}", - "m": 2, - "n": 2, - "singleAddress": false, - "status": "pending", - "publicKeyRing": [], - "copayers": [{ - "version": 2, - "createdOn": 1465347188, - "xPubKey": "xpub6CkPnrzSUp9qzBVM3hpo4oS2JKC6GJq6brE1yW59QrnhDpvkFLakpxUGRGXH62fiXb5S2VbnD4h2DLoCMfSkwfonbNgNYTJw9Ko5SqWEqCR", - "id": "3d4eb9b439eee1b2b73cf792eda52e420f4665109c7234a50cf3cdbf296ea8fb", - "name": "{\"iv\":\"BZQVWAP6d1e4G8Fq1rQKbA==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"wwZd+2LQgYR6cA==\"}", - "requestPubKey": "022941a5ecb8c7224f812ad6b03bd1c9bb77861080b21703eabe18ef9a72b48e72", - "signature": "30440220521623cf346f667658c00f1dea113407f23cecf02932c7dcb4b8bf35f1836b7a02202c77b8e4260942f4e13a58faae1f92e1130bae1157492056347e66741150eb2c", - "requestPubKeys": [{ - "key": "022941a5ecb8c7224f812ad6b03bd1c9bb77861080b21703eabe18ef9a72b48e72", - "signature": "30440220521623cf346f667658c00f1dea113407f23cecf02932c7dcb4b8bf35f1836b7a02202c77b8e4260942f4e13a58faae1f92e1130bae1157492056347e66741150eb2c" - }], - "customData": "{\"iv\":\"BZQVWAP6d1e4G8Fq1rQKbA==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"YJqN/LtkCY0cOB235RtbGEAY7wKGT0cUUpAvUeLkAUKz3/1axsYZtnG+PU0jHtwQvgmKNLkNcXNR60K+tyRpU0TG1z8pyx4gKwwD3Dt7KzA=\"}" - }], - "pubKey": "026d95bb5cc2a30c19e22379ae78b4757aaa2dd0ccbd15a1db054fb50cb98ed361", - "network": "livenet", - "derivationStrategy": "BIP44", - "addressType": "P2SH", - "addressManager": { - "version": 2, - "derivationStrategy": "BIP44", - "receiveAddressIndex": 0, - "changeAddressIndex": 0, - "copayerIndex": 2147483647 - }, - "scanStatus": null - } - }, - - }; // TODO: Read from file - - beforeEach(function(done) { - mocks.init(fixtures, 'createController', {}, done); - }) - - - afterEach(function(done) { - mocks.clear({}, done); - }); - - - it('should be defined', function() { - should.exist(ctrl); - }); - - it('should create a 1-1 wallet from mnemonic', function(done) { - var fakeForm = {}; - - // FROM DATA - scope.seedSource = { - id: 'set' - }; - scope.requiredCopayers = 1; - scope.totalCopayers = 1 - scope.walletName = 'A test wallet'; - scope.isTestnet = false; - scope.bwsurl = null; - scope.isSingleAddress = false; - scope.privateKey = 'legal winner thank year wave sausage worth useful legal winner thank yellow'; - scope._walletPrivKey = 'Kz4CFSTgLzoYfMkt97BTBotUbZYXjMts6Ej9HbVfCf5oLmun1BXy'; - - ctrl.setSeedSource(); - ctrl.create(fakeForm); - - 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(); - }); - }); - - - it('should create an incomplete 2-2 wallet from mnemonic', function(done) { - var fakeForm = {}; - - // FROM DATA - scope.seedSource = { - id: 'set' - }; - scope.requiredCopayers = 2; - scope.totalCopayers = 2; - scope.walletName = 'A test wallet'; - scope.isTestnet = false; - scope.bwsurl = null; - scope.privateKey = 'dizzy cycle skirt decrease exotic fork sure mixture hair vapor copper hero'; - scope._walletPrivKey = 'Kz4CFSTgLzoYfMkt97BTBotUbZYXjMts6Ej9HbVfCf5oLmun1BXy'; - - ctrl.setSeedSource(); - ctrl.create(fakeForm); - - should.not.exist(ctrl.error); - mocks.go.walletHome.calledOnce.should.equal(true, 'Go Wallet Home Called'); - - // 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('xprv9s21ZrQH143K27bhzfejhNcitEAJgLKCfdLxwhr1FLu43FLqLwscAxXgmkucpF4k8eGmepSctkiQDbcR98Qd1bzSeDuR9jeyQAQEanPT2A4'); - // m/44'/0'/0' - c.xPubKey.should.equal('xpub6CkPnrzSUp9qzBVM3hpo4oS2JKC6GJq6brE1yW59QrnhDpvkFLakpxUGRGXH62fiXb5S2VbnD4h2DLoCMfSkwfonbNgNYTJw9Ko5SqWEqCR'); - done(); - }); - }); - -}); diff --git a/test/controllers/disclaimer.test.js b/test/controllers/disclaimer.test.js deleted file mode 100644 index 9a8709582..000000000 --- a/test/controllers/disclaimer.test.js +++ /dev/null @@ -1,82 +0,0 @@ -describe('disclaimerController', function() { - var walletService; - var storeProfile; - - var fixtures = { - 'e4d8ae25e03e5fef2e553615b088cfce222083828c13fdb37b8b6cf87bf76236': { - "walletId": "215f125d-57e7-414a-9723-448256113440", - }, - '3f3b354d45c3eae3e4fe8830fcb728e5e570515af86e1a35deff0048a7a5e6b5': { - "copayerId": "1a91ead1b6d13da882a25377a20e460df557e77008ea4f60eecbf984f786cf03", - "wallet": { - "version": "1.0.0", - "createdOn": 1465347281, - "id": "215f125d-57e7-414a-9723-448256113440", - "name": "{\"iv\":\"BZQVWAP6d1e4G8Fq1rQKbA==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"/gaG7FIkhCiwsWKZUR0sL/cxH+zHMK0=\"}", - "m": 1, - "n": 1, - "singleAddress": false, - "status": "complete", - "publicKeyRing": [{ - "xPubKey": "xpub6Cb7MYAX7mJR28MfFueCsoDVVHhoWkQxRC4viAeHanYwRNgDo5xMF42xmAeExzfyPXX3GaALNA8hWFMekVYvDF2BALommUhMgZ52szh88fd", - "requestPubKey": "029a167eebe3ccd9987d41743477f8b75e1f3c30463187e1b106e0cc1155efa4dd" - }], - "copayers": [{ - "version": 2, - "createdOn": 1465347281, - "xPubKey": "xpub6Cb7MYAX7mJR28MfFueCsoDVVHhoWkQxRC4viAeHanYwRNgDo5xMF42xmAeExzfyPXX3GaALNA8hWFMekVYvDF2BALommUhMgZ52szh88fd", - "id": "1a91ead1b6d13da882a25377a20e460df557e77008ea4f60eecbf984f786cf03", - "name": "{\"iv\":\"BZQVWAP6d1e4G8Fq1rQKbA==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"wwZd+2LQgYR6cA==\"}", - "requestPubKey": "029a167eebe3ccd9987d41743477f8b75e1f3c30463187e1b106e0cc1155efa4dd", - "signature": "3045022100ac3f31ef145eabde6a125958aa9d63c2bd4aa27717d7f6905c3e3ff1e733ee8e02206a43200b775ee5c8f7a85c4d3309d155240d5de46a7d9c5e60045bf49779f40b", - "requestPubKeys": [{ - "key": "029a167eebe3ccd9987d41743477f8b75e1f3c30463187e1b106e0cc1155efa4dd", - "signature": "3045022100ac3f31ef145eabde6a125958aa9d63c2bd4aa27717d7f6905c3e3ff1e733ee8e02206a43200b775ee5c8f7a85c4d3309d155240d5de46a7d9c5e60045bf49779f40b" - }], - "customData": "{\"iv\":\"BZQVWAP6d1e4G8Fq1rQKbA==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"9l63hoVnA71LshCC5xbOTHA+ivBzux7u8SAci56p4aaVIF4qzXQhQKFX+sAFGfBjULm/E1st6awdXnxbAgjbF7D0zsbBFLFOSCw+ko5Xc6o=\"}" - }], - "pubKey": "026d95bb5cc2a30c19e22379ae78b4757aaa2dd0ccbd15a1db054fb50cb98ed361", - "network": "livenet", - "derivationStrategy": "BIP44", - "addressType": "P2PKH", - "addressManager": { - "version": 2, - "derivationStrategy": "BIP44", - "receiveAddressIndex": 0, - "changeAddressIndex": 0, - "copayerIndex": 2147483647 - }, - "scanStatus": null - } - }, - }; // TODO: Read from file - - beforeEach(function(done) { - - mocks.init(fixtures, 'disclaimerController', { - initController: true, - noProfile: true, - }, done); - }); - - afterEach(function(done) { - mocks.clear({}, done); - }); - - it('should be defined', function() { - should.exist(ctrl); - }); - - it('should create the initial profile', function(done) { - localStorage.clear(); - ctrl.init({ - walletPrivKey: 'Kz4CFSTgLzoYfMkt97BTBotUbZYXjMts6Ej9HbVfCf5oLmun1BXy', - mnemonic: 'tunnel fork scare industry noble snow tank bullet over gesture nuclear next', - }); - setTimeout(function() { - mocks.ongoingProcess.set.getCall(1).args[0].should.equal('creatingWallet'); - mocks.ongoingProcess.set.getCall(1).args[1].should.equal(false); - done(); - }, 100); - }); -}); diff --git a/test/controllers/import.test.js b/test/controllers/import.test.js deleted file mode 100644 index b5c21b456..000000000 --- a/test/controllers/import.test.js +++ /dev/null @@ -1,112 +0,0 @@ -describe('importController', function() { - var walletService; - var storeProfile; - - var fixtures = { - '31f5deeef4cf7fd8fc67297179232e8e4590532960454ad958009132fef3daae': {}, - '4599136eff6deb4c9c78043fa84113617a16d75c45920d662305f6227ae8f0a0': { - "wallet": { - "version": "1.0.0", - "createdOn": 1463488747, - "id": "267bfa75-5575-4af7-8aa3-f5186bc99262", - "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, - "status": "complete", - "publicKeyRing": [{ - "xPubKey": "xpub6DRjAgkh3vGTWDcEmDp4TPwy48Nu8yrp6swCEdCCLL615CgnZon7r3vXYr8LYibMLJh5DriGSito1FRBwVoBkjD1ZWG4dmgiC935wLj3nQC", - "requestPubKey": "02befcc7499abcecf9608bb05e665f374434a89ca0c4e9baeab7dd28c027143458" - }], - "copayers": [{ - "version": 2, - "createdOn": 1463490295, - "id": "a9dcee10fe9c611300e6c7926ece20780f89b9a98baaa342928038b5503ed929", - "name": "{\"iv\":\"BZQVWAP6d1e4G8Fq1rQKbA==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"wwZd+2LQgYR6cA==\"}", - "xPubKey": "xpub6DRjAgkh3vGTWDcEmDp4TPwy48Nu8yrp6swCEdCCLL615CgnZon7r3vXYr8LYibMLJh5DriGSito1FRBwVoBkjD1ZWG4dmgiC935wLj3nQC", - "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 - }, - "preferences": {}, - "pendingTxps": [], - "balance": { - "totalAmount": 0, - "lockedAmount": 0, - "totalConfirmedAmount": 0, - "lockedConfirmedAmount": 0, - "availableAmount": 0, - "availableConfirmedAmount": 0, - "byAddress": [], - "totalBytesToSendMax": 0, - "totalBytesToSendConfirmedMax": 0 - } - } - - }; // TODO: Read from file - - beforeEach(function(done){ - mocks.init(fixtures, 'importController', {}, done); - }) - - afterEach(function(done){ - mocks.clear({}, done); - }); - - - - it('should be defined', function() { - should.exist(ctrl); - }); - - it('should import a 1-1 wallet from mnemonic', function(done) { - var fakeForm = { - words: { - $modelValue: 'legal winner thank year wave sausage worth useful legal winner thank yellow' - }, - passphrase: {} - }; - - // FROM DATA - scope.seedSource = { - id: 'set' - }; - scope.bwsurl = null; - scope._walletPrivKey = 'Kz4CFSTgLzoYfMkt97BTBotUbZYXjMts6Ej9HbVfCf5oLmun1BXy'; - - scope.setSeedSource(); - - scope.importMnemonic(fakeForm); - should.not.exist(scope.error); - - mocks.notification.success.calledOnce.should.equal(true); - -// 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(); - }); - }); -}); diff --git a/test/controllers/index.test.js b/test/controllers/index.test.js deleted file mode 100644 index 140e30b38..000000000 --- a/test/controllers/index.test.js +++ /dev/null @@ -1,71 +0,0 @@ -describe('index', function() { - - var walletService; - - - describe('Incomplete wallet', function() { - beforeEach(function(done) { - mocks.init(FIXTURES, 'indexController', { - loadProfile: PROFILE.incomplete2of2, - initController: true, - }, done); - }); - - afterEach(function(done) { - mocks.clear({}, done); - }); - - it('should be defined', function() { - should.exist(ctrl); - }); - it('should set the invitation code for incomplete wallets', function(done) { - should.exist(ctrl); - - ctrl.walletSecret.should.equal('GJ1A8mopdW7wPNWGVksqwQKz4CFSTgLzoYfMkt97BTBotUbZYXjMts6Ej9HbVfCf5oLmun1BXyL'); - // should redirect to copayers - mocks.go.path.getCall(0).args[0].should.equal('copayers'); - done(); - }); - }); - - describe('Complete 1-1 wallet', function() { - beforeEach(function(done) { - mocks.init(FIXTURES, 'indexController', { - loadProfile: PROFILE.testnet1of1, - initController: true, - }, done); - }); - - afterEach(function(done) { - mocks.clear({}, done); - }); - - it('should not set the invitation code for complete wallets', function() { - // should redirect to copayers - mocks.go.path.callCount.should.equal(0); - should.not.exist(ctrl.walletSecret); - }); - - it('should set main wallet info', function(done) { - ctrl.walletName.should.equal('kk'); - ctrl.totalBalanceSat.should.equal(1847686); - done(); - }); - - it('should set information for receive tab', function(done) { - ctrl.tab.should.equal('walletHome'); - ctrl.setTab('receive'); - ctrl.tab.should.equal('receive'); - done(); - }); - - - it.skip('should updates remote preferences', function(done) { - ctrl.updateRemotePreferences({}, function() { - done(); - }); - }); - }); - - -}); diff --git a/test/controllers/join.test.js b/test/controllers/join.test.js deleted file mode 100644 index 40fb11edd..000000000 --- a/test/controllers/join.test.js +++ /dev/null @@ -1,150 +0,0 @@ -describe('joinController', function() { - - var walletService; - - var fixtures = { - // join - '668623e51aaae25c637fb9c57bb30a169a0ff67fa1e67e6e61643c7e5e580a66': { - "copayerId": "962fb5dd31d9f715efdbb33d41533d272bb6c2ecd28bbb8181358f86b08253dd", - "wallet": { - "version": "1.0.0", - "createdOn": 1466006460, - "id": "10387ed3-51cf-43b4-91fe-ad85ca2ae368", - "name": "{\"iv\":\"4Agx234j4p+TQS0QXj7bow==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"IEohefHXl/tr4rA=\"}", - "m": 2, - "n": 2, - "singleAddress": false, - "status": "complete", - "publicKeyRing": [{ - "xPubKey": "xpub6C6dynsH56i7VhzHzo2ZcJguHsjYuUuoPcAdku8h6c7ZaJSYb4WQjKcGdggbpWEuaQspY3LHmFUoCQhk1ErmdegXnsJeSxoKqiPD1CUxVvT", - "requestPubKey": "0200fbedb7d04af9edbd1602103c1ff68454fd009fd8b1acd957441e776c69ff59" - }, { - "xPubKey": "xpub6BsR71KDdSPMePtuipRiWKMC2Q9XEXfk6WM1trbJzPEhcwVBKyN9UhWtpnGv2pu4mtZyKFRgwL98hDH6TBdeEFNVp8Jf81kPBKPeWpn4sWr", - "requestPubKey": "02ad777ba00bf085a2d167c0600df290037d40e5e0d33b5f8e345b0b80a8861bd4" - }], - "copayers": [{ - "version": 2, - "createdOn": 1466006460, - "id": "4f72d7bc290a0343a5096cf28999d5d329a9be42651b061fb9489130d0cf9af9", - "name": "{\"iv\":\"RZr7/0eA7F70T/wBCJo7kw==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"nL4c40ADLWELtoE=\"}", - "xPubKey": "xpub6C6dynsH56i7VhzHzo2ZcJguHsjYuUuoPcAdku8h6c7ZaJSYb4WQjKcGdggbpWEuaQspY3LHmFUoCQhk1ErmdegXnsJeSxoKqiPD1CUxVvT", - "requestPubKey": "0200fbedb7d04af9edbd1602103c1ff68454fd009fd8b1acd957441e776c69ff59", - "signature": "304402200af094bbb7c432c9a1323534db125431c87bdec9678f40e89a42f209115a222202207a87a27b5f14bf931e1a15d71aa8407118398e5540a8fcbaf7caffef534b6a49", - "requestPubKeys": [{ - "key": "0200fbedb7d04af9edbd1602103c1ff68454fd009fd8b1acd957441e776c69ff59", - "signature": "304402200af094bbb7c432c9a1323534db125431c87bdec9678f40e89a42f209115a222202207a87a27b5f14bf931e1a15d71aa8407118398e5540a8fcbaf7caffef534b6a49" - }], - "customData": "{\"iv\":\"kSIFrEhNScxUNG5BMnV34A==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"strUeMXiPhTPmsatrStRfaF9+ZD1LU+m+I6Xeu4m0s43DIqc/DYJwm+37fatohNKQ6J7FQKTCJUgMiidAe30K6Dw7J7GA6mFhedMsGLJNbOmBEhRN0AAbwXW6B0=\"}" - }, { - "version": 2, - "createdOn": 1466006511, - "xPubKey": "xpub6BsR71KDdSPMePtuipRiWKMC2Q9XEXfk6WM1trbJzPEhcwVBKyN9UhWtpnGv2pu4mtZyKFRgwL98hDH6TBdeEFNVp8Jf81kPBKPeWpn4sWr", - "id": "962fb5dd31d9f715efdbb33d41533d272bb6c2ecd28bbb8181358f86b08253dd", - "name": "{\"iv\":\"BZQVWAP6d1e4G8Fq1rQKbA==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"UKYkKqeia8gWrLqaJ+TuzA/LVlrG\"}", - "requestPubKey": "02ad777ba00bf085a2d167c0600df290037d40e5e0d33b5f8e345b0b80a8861bd4", - "signature": "3045022100f7c7bbc49ce679e67420db8614bf59dfbd798e8ad95a0427305ae5008e0aa41b02203997647b80cc6e5a365048dc5b7b1822809b3c9209a053aaeef7e9f3920d7cef", - "requestPubKeys": [{ - "key": "02ad777ba00bf085a2d167c0600df290037d40e5e0d33b5f8e345b0b80a8861bd4", - "signature": "3045022100f7c7bbc49ce679e67420db8614bf59dfbd798e8ad95a0427305ae5008e0aa41b02203997647b80cc6e5a365048dc5b7b1822809b3c9209a053aaeef7e9f3920d7cef" - }], - "customData": "{\"iv\":\"BZQVWAP6d1e4G8Fq1rQKbA==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"HTlgRDT46ysMT3+XzhxeXgrOfJ1Fq+kiTWG/q7RqISdWWE+cmP5LcI6+PSysEpo66AjOlI9ofyMVxKtptabWYSNgydrhnqZ5EKY0TnFRq8Ov7a8+btXf9n9BDsM=\"}" - }], - "pubKey": "03bdebf86549b272addd61076e026d2f6a225db514f08b8fad08536a8c4a6792c1", - "network": "livenet", - "derivationStrategy": "BIP44", - "addressType": "P2SH", - "addressManager": { - "version": 2, - "derivationStrategy": "BIP44", - "receiveAddressIndex": 0, - "changeAddressIndex": 0, - "copayerIndex": 2147483647 - }, - "scanStatus": null - } - }, - - '197031879d401f75c308e3d5014ac2e9560ec805e1fdd58c778e0ae0bfe7ec0a': {}, - } - - beforeEach(function(done) { - mocks.init(fixtures, 'joinController', {}, done); - }) - - - afterEach(function(done) { - mocks.clear({}, done); - }); - - - - it('should be defined', function() { - should.exist(ctrl); - }); - - // // Get html template from cache - // beforeEach(inject(function($templateCache) { - // viewHtml = $templateCache.get("some/valid/templateUrl"); - // })); - // // beforeEach(inject(function(_$compile_, _$rootScope_){ - // $compile = _$compile_; - // $rootScope = _$rootScope_; - // - // $scope = $rootScope.$new(); - // $scope.user = {}; - // $scope.logout = sinon.stub(); - // dropdownElement = angular.element(viewHtml); - // })); - - it('should join a wallet once the form is submitted', function(done) { - // View' s joinForm is not available - //join.onQrCodeScanned('aQRCode'); - // - - - - scope.seedSource = { - id: 'set' - }; - ctrl.setSeedSource(); - - // FROM DATA - scope._walletPrivKey = 'Kz4CFSTgLzoYfMkt97BTBotUbZYXjMts6Ej9HbVfCf5oLmun1BXy'; - var fakeForm = { - secret: { - $modelValue: '31B6DG8f12vGhG7hWhQy2PKwngiNnQ4ijPcePSwanQ2gD6N4mWs3eVPtdwZqRQbHnLQyxhoJksL' - }, - myName: { - $modelValue: 'myCopayerName' - }, - - bwsurl: 'null', - createPassphrase: { - $modelValue: null - }, - privateKey: { - $modelValue: 'useful poet rely letter cause fat student tumble animal toddler proof husband', - }, - passphrase: { - $modelValue: null, - }, - }; - ctrl.join(fakeForm); - should.not.exist(ctrl.error); - mocks.go.walletHome.calledOnce.should.equal(true, 'Go Wallet Home Called'); - - // 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('xprv9s21ZrQH143K3ettHXncETrbUjzrTB7yBfhzjnYjbFgExeNMecTGPvJgje2WQeSFS17Sd8ssz8FQuCbm4rK62ojAwPCX8GHtjHNHsmJsbUa'); - // m/44'/0'/0' - c.xPubKey.should.equal('xpub6BsR71KDdSPMePtuipRiWKMC2Q9XEXfk6WM1trbJzPEhcwVBKyN9UhWtpnGv2pu4mtZyKFRgwL98hDH6TBdeEFNVp8Jf81kPBKPeWpn4sWr'); - c.walletName.should.equal('2-2'); - done(); - }); - - }); -}); diff --git a/test/controllers/preferencesHistory.test.js b/test/controllers/preferencesHistory.test.js deleted file mode 100644 index 8c8ec6d3a..000000000 --- a/test/controllers/preferencesHistory.test.js +++ /dev/null @@ -1,37 +0,0 @@ -describe('Preferences History Controller', function() { - - var walletService; - - var txHistory = '[{"txid":"bf31ecaa8e10ce57f9a889fc4c893b40ff57b016dd763957d942e21ed55fc62c","action":"received","amount":120000,"fees":4862,"time":1464969291,"confirmations":8,"outputs":[{"amount":120000,"address":"2N4HgtF9cJSzxhVkj5gbKxwJSKWBmnb9FNJ","message":null}],"note":{"body":"just a comment","editedBy":"31a8c3c0be9ffbb9f257c95f3fd2f73a59cf81e40199ba5918417270db8c4cdb","editedByName":"2-2","editedOn":1464969101},"message":null,"creatorName":"","hasUnconfirmedInputs":false,"amountStr":"1,200 bits","alternativeAmountStr":"0.68 USD","feeStr":"49 bits","safeConfirmed":"6+"}]'; - - describe('Complete 1-1 wallet', function() { - beforeEach(function(done) { - mocks.init(FIXTURES, 'preferencesHistory', { - loadProfile: PROFILE.testnet1of1, - loadStorage: { - 'txsHistory-66d3afc9-7d76-4b25-850e-aa62fcc53a7d': txHistory, - }, - }, done); - }); - - afterEach(function(done) { - mocks.clear({}, done); - }); - - it('should be defined', function() { - should.exist(ctrl); - }); - - it('should export csv', function(done) { - scope.csvHistory(function(err) { - should.not.exist(err); - should.exist(scope.csvReady); - scope.csvReady.should.equal(true); - should.exist(scope.csvContent); - JSON.stringify(scope.csvContent).should.equal('[{"Date":"2016-06-03T15:54:51.000Z","Destination":"","Description":"","Amount":"0.00120000","Currency":"BTC","Txid":"bf31ecaa8e10ce57f9a889fc4c893b40ff57b016dd763957d942e21ed55fc62c","Creator":"","Copayers":"","Comment":"just a comment"}]'); - done(); - }); - }); - }); - -}); diff --git a/test/controllers/walletHome.test.js b/test/controllers/walletHome.test.js deleted file mode 100644 index 5fa381bcc..000000000 --- a/test/controllers/walletHome.test.js +++ /dev/null @@ -1,19 +0,0 @@ -describe('walletHome', function() { - - var walletService; - var fixtures = {}; - - - beforeEach(function(done){ - mocks.init(fixtures, 'walletHomeController', {}, done); - }) - - afterEach(function(done){ - mocks.clear({}, done); - }); - - it('should be defined', function() { - should.exist(ctrl); - }); - -}); diff --git a/test/fixtures.js b/test/fixtures.js deleted file mode 100644 index 6d3664618..000000000 --- a/test/fixtures.js +++ /dev/null @@ -1,1405 +0,0 @@ -var walletInfo = { - "wallet": { - "version": "1.0.0", - "createdOn": 1463511645, - "id": "7bd8d22f-d132-43e1-b259-d5b430752553", - "name": "{\"iv\":\"BZQVWAP6d1e4G8Fq1rQKbA==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"70OA+k4+xTPxim+QSdDtA5/Cf055\"}", - "m": 2, - "n": 2, - "status": "pending", - "publicKeyRing": [], - "copayers": [{ - "version": 2, - "createdOn": 1463511988, - "id": "3d4eb9b439eee1b2b73cf792eda52e420f4665109c7234a50cf3cdbf296ea8fb", - "name": "{\"iv\":\"BZQVWAP6d1e4G8Fq1rQKbA==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"wwZd+2LQgYR6cA==\"}", - "xPubKey": "xpub6CkPnrzSUp9qzBVM3hpo4oS2JKC6GJq6brE1yW59QrnhDpvkFLakpxUGRGXH62fiXb5S2VbnD4h2DLoCMfSkwfonbNgNYTJw9Ko5SqWEqCR", - "requestPubKey": "022941a5ecb8c7224f812ad6b03bd1c9bb77861080b21703eabe18ef9a72b48e72", - "signature": "30440220521623cf346f667658c00f1dea113407f23cecf02932c7dcb4b8bf35f1836b7a02202c77b8e4260942f4e13a58faae1f92e1130bae1157492056347e66741150eb2c", - "requestPubKeys": [{ - "key": "022941a5ecb8c7224f812ad6b03bd1c9bb77861080b21703eabe18ef9a72b48e72", - "signature": "30440220521623cf346f667658c00f1dea113407f23cecf02932c7dcb4b8bf35f1836b7a02202c77b8e4260942f4e13a58faae1f92e1130bae1157492056347e66741150eb2c" - }], - "customData": "{\"iv\":\"BZQVWAP6d1e4G8Fq1rQKbA==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"YJqN/LtkCY0cOB235RtbGEAY7wKGT0cUUpAvUeLkAUKz3/1axsYZtnG+PU0jHtwQvgmKNLkNcXNR60K+tyRpU0TG1z8pyx4gKwwD3Dt7KzA=\"}" - }], - "pubKey": "026d95bb5cc2a30c19e22379ae78b4757aaa2dd0ccbd15a1db054fb50cb98ed361", - "network": "livenet", - "derivationStrategy": "BIP44", - "addressType": "P2SH", - "addressManager": { - "version": 2, - "derivationStrategy": "BIP44", - "receiveAddressIndex": 0, - "changeAddressIndex": 0, - "copayerIndex": 2147483647 - }, - "scanStatus": null - }, - "preferences": {}, - "pendingTxps": [], - "balance": { - "totalAmount": 0, - "lockedAmount": 0, - "totalConfirmedAmount": 0, - "lockedConfirmedAmount": 0, - "availableAmount": 0, - "availableConfirmedAmount": 0, - "byAddress": [], - "totalBytesToSendMax": 0, - "totalBytesToSendConfirmedMax": 0 - } -}; - -var FIXTURES = { - - // store preferences - '1eda3e702196b8d5d82fae129249bc79f0d5be2f5309a4e39855e7eb4ad31428': {}, - - // Incomplete wallet status - 'd05582c35aa545494e3f3be9713efa9df112d36a324350f6b7141996b824bce2': walletInfo, - // ^ same thing, twostep=1 - '56f430fcd3987d37d5818b1c0a716544c0115cd1b65e3bf163006b1823494ad2': walletInfo, - // put /preferences - '8fb7fc4644c3828a7df61185a08504c685df0867b21c6ad2a386d69bc3a1a568': {}, - // - '980fad92e75cdfdfe59d139bf1f65ff3ccb7b0e56718637fd9de5842f7875312': { - "version": "1.0.0", - "createdOn": 1463520484, - "walletId": "7bd8d22f-d132-43e1-b259-d5b430752553", - "copayerId": "3d4eb9b439eee1b2b73cf792eda52e420f4665109c7234a50cf3cdbf296ea8fb", - "email": null, - "language": null, - "unit": "bit" - }, - - // Complete 1-1 wallet status - // - 'adf7024c3573a59f42e712d894bcc1f41eb8f946a8aefba52359e2b034bdf0d4': { - "wallet": { - "version": "1.0.0", - "createdOn": 1455745883, - "id": "66d3afc9-7d76-4b25-850e-aa62fcc53a7d", - "name": "kk", - "m": 1, - "n": 1, - "status": "complete", - "copayers": [{ - "version": 2, - "createdOn": 1455745883, - "id": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "name": "copayer 1", - "requestPubKeys": [{ - "key": "038bb7cc1238280e893dd6949bfce770a319892b3c9045112ec7810191d4157ced", - "signature": "304402207fe3d127734bea08231597f7f06bf61b5dd8c9ba63cf512fd4b0fac2d5d9144c022028566c6fdc959c1c107f9c0d79f8b287aa500bf5a3e022b9ea49eb33392e4566" - }] - }], - "network": "testnet", - "derivationStrategy": "BIP44", - "addressType": "P2PKH", - "scanStatus": "success" - }, - "preferences": {}, - "pendingTxps": [], - "balance": { - "totalAmount": 1847686, - "lockedAmount": 0, - "totalConfirmedAmount": 1847686, - "lockedConfirmedAmount": 0, - "availableAmount": 1847686, - "availableConfirmedAmount": 1847686, - "byAddress": [{ - "address": "mnZ3vC2u2GcAbWBvxVnB5V4F8QcwKg3fkp", - "path": "m/1/46", - "amount": 1843286 - }, { - "address": "n2mwd1JeJWCaLTfTAZMJtiWVyC3y1Wbfid", - "path": "m/0/16", - "amount": 4400 - }], - "totalBytesToSendMax": 578, - "totalBytesToSendConfirmedMax": 578 - } - }, - // History - '499c8fcad0c1895054a82b3d2f8df81fd98789871f1d87e5aa88521177bb15fb': [{ - "txid": "49d69287e6e284b5ae845ef61e90dc6709e6a3f1f0c94cf665ff1d8d6e4efc71", - "action": "sent", - "amount": 1000000, - "fees": 9720, - "time": 1462156858, - "addressTo": "mrYKc2NYioXxbQSSRDdUh9QwBYS3h3BFvV", - "confirmations": 40706, - "outputs": [{ - "amount": 1000000, - "address": "mrYKc2NYioXxbQSSRDdUh9QwBYS3h3BFvV" - }] - }, { - "txid": "2e9f7e73208c70fea6ab51944c9de33cb2d0cc936a98386e0024c743844cdf3f", - "action": "sent", - "amount": 10000, - "fees": 9720, - "time": 1462138505, - "addressTo": "mtevLzhkNMeV1T8px5aghSjT5WeeXQVT2i", - "confirmations": 40897, - "outputs": [{ - "amount": 10000, - "address": "mtevLzhkNMeV1T8px5aghSjT5WeeXQVT2i" - }] - }, { - "txid": "d799112cb54e60019503219af445172eeaa1f6fb41ee3a27bedc70c95ac6e70b", - "action": "sent", - "amount": 10000, - "fees": 2439, - "time": 1462072762, - "addressTo": "mtevLzhkNMeV1T8px5aghSjT5WeeXQVT2i", - "confirmations": 41387, - "outputs": [{ - "amount": 10000, - "address": "mtevLzhkNMeV1T8px5aghSjT5WeeXQVT2i" - }] - }, { - "txid": "9dd0971ad83bfb276ac76811352bc92c55d9f51a0038157614b35896913c2cea", - "action": "sent", - "amount": 2200, - "fees": 4261, - "time": 1462070325, - "addressTo": "mtevLzhkNMeV1T8px5aghSjT5WeeXQVT2i", - "confirmations": 41389, - "outputs": [{ - "amount": 2200, - "address": "mtevLzhkNMeV1T8px5aghSjT5WeeXQVT2i" - }] - }, { - "txid": "094b30e77fdfc20617ed9da08c46d0e342c0cc6a5271e59fc59c4e731681ad51", - "action": "sent", - "amount": 1100, - "fees": 2439, - "time": 1462043263, - "addressTo": "mmvNFchzzpWX5Yzx3j5A1vLf5KV9KtGEfo", - "confirmations": 41650, - "outputs": [{ - "amount": 1100, - "address": "mmvNFchzzpWX5Yzx3j5A1vLf5KV9KtGEfo" - }], - }], - // txhistory 1-1 testnet - 'be65742a355b926d4e7bc7acf5194930474ec8db885e2c65f22791b7cdb8c4f0': [{ - "txid": "6fa0a54f0d7e8518f8622bd6e84224ea41bbf0cd6238ad127d1751b924e915a2", - "action": "sent", - "amount": 10000, - "fees": 2439, - "time": 1462035742, - "addressTo": "mtevLzhkNMeV1T8px5aghSjT5WeeXQVT2i", - "confirmations": 41748, - "outputs": [{ - "amount": 10000, - "address": "mtevLzhkNMeV1T8px5aghSjT5WeeXQVT2i", - "message": null - }], - "proposalId": "014620287996740afec64f-2b23-4fa9-9ba1-21a9939334e8", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1462028803, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "310d2792edd87e7cbeb77907ca3c70ec8f061dd806f1618b21e5224d8cf2b5b7", - "action": "sent", - "amount": 10000, - "fees": 2439, - "time": 1462029578, - "addressTo": "mmvNFchzzpWX5Yzx3j5A1vLf5KV9KtGEfo", - "confirmations": 41802, - "outputs": [{ - "amount": 10000, - "address": "mmvNFchzzpWX5Yzx3j5A1vLf5KV9KtGEfo", - "message": null - }], - "proposalId": "0146202332218821437804-3a42-4179-b4ef-779651699120", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1462023324, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "ba06ed943dbbf6d8316c8da67acee71e648a1db6e8eb54bff7832500f2e71263", - "action": "sent", - "amount": 21000, - "fees": 9000, - "time": 1462028414, - "addressTo": "mtevLzhkNMeV1T8px5aghSjT5WeeXQVT2i", - "confirmations": 41822, - "outputs": [{ - "amount": 21000, - "address": "mtevLzhkNMeV1T8px5aghSjT5WeeXQVT2i", - "message": null - }], - "proposalId": "014620205262398f9fbb3c-fa0e-4e89-8c01-c462aeac75de", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1462020528, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "bf13ca5e0375185a1ce1e6c2068d0ae5a7965e72e71d715e63df00b586600155", - "action": "sent", - "amount": 22200, - "fees": 2439, - "time": 1462028360, - "addressTo": "mtevLzhkNMeV1T8px5aghSjT5WeeXQVT2i", - "confirmations": 41816, - "outputs": [{ - "amount": 22200, - "address": "mtevLzhkNMeV1T8px5aghSjT5WeeXQVT2i", - "message": null - }], - "proposalId": "01462020614530e1178805-4eae-497e-b20a-e81ac3c3dd37", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1462021427, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "1d3ca0adb421f7fc5290ab5018b9f167a5b9f506a0d4aec61064f90cee43afd2", - "action": "sent", - "amount": 22200, - "fees": 2439, - "time": 1462028357, - "addressTo": "mmvNFchzzpWX5Yzx3j5A1vLf5KV9KtGEfo", - "confirmations": 41805, - "outputs": [{ - "amount": 22200, - "address": "mmvNFchzzpWX5Yzx3j5A1vLf5KV9KtGEfo", - "message": null - }], - "proposalId": "01462021663526fac48a42-10b0-4c45-a196-48a80ae61ae5", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1462022922, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "d7aa52c264719da786d3d0e6139c2e280834db02354fc334dc8d1d0c96a4cb77", - "action": "sent", - "amount": 1100, - "fees": 3300, - "time": 1462008652, - "addressTo": "mtevLzhkNMeV1T8px5aghSjT5WeeXQVT2i", - "confirmations": 41991, - "outputs": [{ - "amount": 1100, - "address": "mtevLzhkNMeV1T8px5aghSjT5WeeXQVT2i", - "message": null - }], - "proposalId": "01462001958646d502eeb6-8829-4f09-951c-fdbae655343d", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1462001961, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "23b4e0b3ef1fd90a42c7088c3464d11c3ede9109d657602c8e811f3a14f377bd", - "action": "sent", - "amount": 22200, - "fees": 10000, - "time": 1462008652, - "addressTo": "mtevLzhkNMeV1T8px5aghSjT5WeeXQVT2i", - "confirmations": 41991, - "outputs": [{ - "amount": 22200, - "address": "mtevLzhkNMeV1T8px5aghSjT5WeeXQVT2i", - "message": null - }], - "proposalId": "01462002020568ca4b9a61-f7e9-417e-a5af-d9d986f648db", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1462002170, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "15df3120c5690e479878441362117214ee27be656f90504ebd895eb50e8188be", - "action": "received", - "amount": 2959321, - "fees": 6985, - "time": 1462008609, - "confirmations": 41995, - "outputs": [{ - "amount": 2959321, - "address": "n2mwd1JeJWCaLTfTAZMJtiWVyC3y1Wbfid" - }] - }, { - "txid": "3fe0f1edca7f4999759d06da0e1a7179048fd7f24bf25af030a341ee4ef50f80", - "action": "received", - "amount": 10000, - "fees": 2439, - "time": 1461990151, - "confirmations": 42324, - "outputs": [{ - "amount": 10000, - "address": "n2mwd1JeJWCaLTfTAZMJtiWVyC3y1Wbfid" - }] - }, { - "txid": "4e2b3359dc53de7f6b6c3e374548bb22f6edf9b36c55e20f38fc9b01d045dd52", - "action": "received", - "amount": 11100, - "fees": 2439, - "time": 1461963912, - "confirmations": 42816, - "outputs": [{ - "amount": 11100, - "address": "n2mwd1JeJWCaLTfTAZMJtiWVyC3y1Wbfid" - }] - }, { - "txid": "3f661f7f43fc9b7a5fe8fc394398c864d9b76431a277bcbe020e342427a5540f", - "action": "received", - "amount": 10000, - "fees": 2439, - "time": 1461963855, - "confirmations": 42828, - "outputs": [{ - "amount": 10000, - "address": "n2mwd1JeJWCaLTfTAZMJtiWVyC3y1Wbfid" - }] - }, { - "txid": "3cd04bf9e46cce847d58b8d0fbbb6d5635e026aec3fd54fe0b980c8e603f235e", - "action": "received", - "amount": 10000, - "fees": 2439, - "time": 1461963834, - "confirmations": 42827, - "outputs": [{ - "amount": 10000, - "address": "n2mwd1JeJWCaLTfTAZMJtiWVyC3y1Wbfid" - }] - }, { - "txid": "a1e27edbac77faf5e9109d675f5132afeea8c7a5751685a0fb18ab0501bc8673", - "action": "received", - "amount": 10000, - "fees": 2438, - "time": 1461949047, - "confirmations": 43222, - "outputs": [{ - "amount": 10000, - "address": "n2mwd1JeJWCaLTfTAZMJtiWVyC3y1Wbfid" - }] - }, { - "txid": "abc01e2a966fdcb64de6f2185e5a677f35dd2657469788ca98014dba23f54d0a", - "action": "received", - "amount": 10000, - "fees": 2438, - "time": 1461945399, - "confirmations": 43301, - "outputs": [{ - "amount": 10000, - "address": "n2mwd1JeJWCaLTfTAZMJtiWVyC3y1Wbfid" - }] - }, { - "txid": "c6ef1b2596a16624030a70467654e82bb6d3f211e768e606d7a41d2856c04181", - "action": "received", - "amount": 4400, - "fees": 6405, - "time": 1461878525, - "confirmations": 45958, - "outputs": [{ - "amount": 4400, - "address": "n2mwd1JeJWCaLTfTAZMJtiWVyC3y1Wbfid" - }] - }, { - "txid": "bfeeafb79e22d92a936ad5ba3e806c9c2f86ab9676ff754ee6be9c66dc0ec8c1", - "action": "received", - "amount": 2200, - "fees": 2438, - "time": 1461855553, - "confirmations": 49553, - "outputs": [{ - "amount": 2200, - "address": "n2mwd1JeJWCaLTfTAZMJtiWVyC3y1Wbfid" - }] - }, { - "txid": "9d01c610927833f7bbc10c75623f73063687c44fad3f9f3730fb6df8727e3661", - "action": "received", - "amount": 2200, - "fees": 2438, - "time": 1461855468, - "confirmations": 49591, - "outputs": [{ - "amount": 2200, - "address": "n2mwd1JeJWCaLTfTAZMJtiWVyC3y1Wbfid" - }] - }, { - "txid": "b7bb9dad39055f3dbe8943d03ffbd6463312107883386edbfc276a91cf64943d", - "action": "received", - "amount": 11100, - "fees": 2439, - "time": 1461780282, - "confirmations": 60334, - "outputs": [{ - "amount": 11100, - "address": "n2mwd1JeJWCaLTfTAZMJtiWVyC3y1Wbfid" - }] - }, { - "txid": "7ce9a68bd8951d6cfefd9ac5ab4b3ee0196b5ee24bbf0f28196bcc7bd5313edb", - "action": "sent", - "amount": 4138994, - "fees": 16790, - "time": 1460566285, - "addressTo": "mmXGGqzRhFeEJFufUJrwtnk3VuQEJHyKhh", - "confirmations": 83134, - "outputs": [{ - "amount": 4138994, - "address": "mmXGGqzRhFeEJFufUJrwtnk3VuQEJHyKhh", - "message": null - }], - "proposalId": "01460558645581d749b541-721b-4fa4-ac57-67c4aa6f6c52", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1460558648, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "659667057122f1e5ed25fa7d650809c907bfb6e5cff6e2ede2fabc13442ebd75", - "action": "received", - "amount": 3930983, - "fees": 7859, - "time": 1460566285, - "confirmations": 83134, - "outputs": [{ - "amount": 3930983, - "address": "mtnUUgPrfSzMCEPaBbshwnwfKJWxZtYBs6" - }] - }, { - "txid": "d3b0882fc40533d41c02bff0a616a2d46b1c689876a9420985781d0edad1151e", - "action": "sent", - "amount": 4400, - "fees": 10789, - "time": 1459470932, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90091, - "outputs": [{ - "amount": 4400, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "01459463705829b29f0237-b1c3-456c-9df7-c4d3382e1c44", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459463713, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "d02f616767b72b4817dc2c6c29fd07046b57f2f7f0910ef2a0d79599b4fcbe5e", - "action": "sent", - "amount": 3300, - "fees": 11244, - "time": 1459470932, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90091, - "outputs": [{ - "amount": 3300, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "0145946365335296086038-0213-46b5-8b13-1eca1269698f", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459463655, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "9655e1110aa57c6f2ca505e9b19dd5b38e61fb3315ac0e53d6b315dd0d67b661", - "action": "sent", - "amount": 24300, - "fees": 10789, - "time": 1459468226, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90117, - "outputs": [{ - "amount": 24300, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "01459462361539714519e1-f9c4-4c5a-91fd-b0b12da50ae9", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459462364, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "2e2562b5ec002dba96af62e8bcfa9b3b65f6f60e96488bc59fbeee3174f750a4", - "action": "sent", - "amount": 23200, - "fees": 10789, - "time": 1459468140, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90124, - "outputs": [{ - "amount": 23200, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "01459462091745b84c94ff-3650-4113-842a-6b49fa379f5e", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459462094, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "75a7aa5fa4d03fd484ee26e0a4aad37ccb0e735dd03027dab63fb12ae8a9cd3b", - "action": "sent", - "amount": 23100, - "fees": 10789, - "time": 1459468129, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90129, - "outputs": [{ - "amount": 23100, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "014594616413651df5dce6-ddc3-4b19-9721-381fd78006db", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459461644, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "7e0494d6c81ee22b24e815f53116cdd143ce2ec4e34bacb7ee5886807f2ac5b0", - "action": "sent", - "amount": 12600, - "fees": 10789, - "time": 1459468071, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90142, - "outputs": [{ - "amount": 12600, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "01459460699253fa66c2cd-4fbb-497d-9086-c45c312f4e24", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459460701, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "b41721474cbc224bbe0f8cc70f3a70219b630962d89e4c369b2009ceda412cb0", - "action": "sent", - "amount": 12400, - "fees": 10789, - "time": 1459467803, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90144, - "outputs": [{ - "amount": 12400, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "01459460605840904d9d5a-ea90-42e5-b147-b9ae65b30f0f", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459460608, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "90c224336162b6391db5be322c1908e7d9d9026545d268d216b3cda664492a2d", - "action": "sent", - "amount": 12300, - "fees": 10789, - "time": 1459467133, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90159, - "outputs": [{ - "amount": 12300, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "014594599176299186cfc9-46b5-4786-bf74-bcdfbe64851d", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459459920, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "ea33f2e62e940c32e883916ed20ee49421228f8af5f50b9674c1be6517d46387", - "action": "sent", - "amount": 13200, - "fees": 10789, - "time": 1459466976, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90137, - "outputs": [{ - "amount": 13200, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "01459461019978babbaa89-4af2-4c89-bc1c-c3111f4d96d1", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459461022, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "6bc31aca5ac5d9a72bb6f12274c4dd34cbdcdf1150998faa3f6d2a848c9e25c6", - "action": "sent", - "amount": 13100, - "fees": 10789, - "time": 1459466976, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90137, - "outputs": [{ - "amount": 13100, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "0145946093051133caeeb7-55a7-4c2b-a2c4-cd175c0ec9c3", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459460933, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "ff167d85c34920255af023d7202545cab1b731d86c6704c6aafa03f5e46155c1", - "action": "sent", - "amount": 12700, - "fees": 10789, - "time": 1459464433, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90175, - "outputs": [{ - "amount": 12700, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "01459458885274a8c84629-1141-4dd2-8402-4d8e4185d796", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459458889, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "82b8b6c0a1f8d0f212aafc5e6ca9a18376001d1895399fffeb94c3d996a7adf5", - "action": "sent", - "amount": 12900, - "fees": 10789, - "time": 1459464433, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90175, - "outputs": [{ - "amount": 12900, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "014594589322742b7adc21-d181-4d8d-a4a9-ccf34a548d18", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459458934, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "330a37ba9a886b9548181fdaa31b2327338e4363947471a6af33b219c085b7f5", - "action": "sent", - "amount": 12200, - "fees": 10789, - "time": 1459462699, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90228, - "outputs": [{ - "amount": 12200, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "014594552277499d2e2dc5-674f-466e-af41-b89930d92c4a", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459455565, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "e8105445a8bfb885588f01d79f2f228759f5c5503ff5feb254f42c2f185a262c", - "action": "sent", - "amount": 12100, - "fees": 10789, - "time": 1459461311, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90247, - "outputs": [{ - "amount": 12100, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "01459454478687a5d6462a-5497-412b-80a7-21dfd8eb8a08", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459454482, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "d58e4953d28538f7ad317a419e3ae44ea38d57947b637b5b7d7154b40e069e81", - "action": "sent", - "amount": 11600, - "fees": 10789, - "time": 1459460981, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90251, - "outputs": [{ - "amount": 11600, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "01459454054176abfedc09-21a7-4fc3-bb7d-5f0a23493917", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459454056, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "1e6cc8f69f5d6130196e5b253bf66e1c384e1eda3897812cef005a4792b3cf0f", - "action": "sent", - "amount": 11300, - "fees": 10789, - "time": 1459460319, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90270, - "outputs": [{ - "amount": 11300, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "01459453123419006f582d-d3f4-4f6d-bb5e-ffb26a5bafe3", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459453126, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "04087ee2e89f5fb80eb20f0b0c4363532967cde86052ac8a9425292e3c1054a7", - "action": "sent", - "amount": 11200, - "fees": 10789, - "time": 1459460054, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90274, - "outputs": [{ - "amount": 11200, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "01459452926578b1accfed-410e-4a14-9640-392211500d98", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459452930, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "35ef08935b01f97b48738478fe5dddac22c53619c6722fa19eee10102869a7bb", - "action": "sent", - "amount": 11100, - "fees": 10789, - "time": 1459460044, - "addressTo": "mg8s31BLMXs6BX33XKRpxhno5Sk9PsA44s", - "confirmations": 90276, - "outputs": [{ - "amount": 11100, - "address": "mg8s31BLMXs6BX33XKRpxhno5Sk9PsA44s", - "message": null - }], - "proposalId": "014594528886574922a970-27ab-4499-8006-795a7e46117f", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459452892, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "4e7ad490b24c02c2dae3d65e690e031bd634c3458bfd057b4a61223cec1c0e28", - "action": "sent", - "amount": 11500, - "fees": 10789, - "time": 1459459598, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90265, - "outputs": [{ - "amount": 11500, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "01459453278803f5779d1a-7dd2-4da0-85ce-8b1254279a78", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459453295, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "2164ad58166f9d6a6a3d9a32bb68bc6942fff5c44e38a4a399d84530f27ef693", - "action": "sent", - "amount": 11400, - "fees": 10789, - "time": 1459459151, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90268, - "outputs": [{ - "amount": 11400, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "0145945316225536ebe7e8-7542-44ec-a5a5-58070566768c", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459453165, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "7bbf03f6cdb749cd15986d0752e94362a0f127f34988282a3335e63fd7b6d610", - "action": "sent", - "amount": 10900, - "fees": 10789, - "time": 1459451596, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90402, - "outputs": [{ - "amount": 10900, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "014594453156721f0d836d-ff16-412f-9e09-0d6be57df9fe", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459445318, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "e1c084f3fb30f935423391844d08c3234d9d2cf3df7a8a7b8eae22e19a0a53b2", - "action": "sent", - "amount": 10600, - "fees": 10789, - "time": 1459445798, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90696, - "outputs": [{ - "amount": 10600, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "014594385235427db69e99-4583-4d8c-bf5f-a2ecdf32a055", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459438526, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "9e594ff0efd56bdc6a72e6abbd75664514fdea07c0a6cec2f817635646cff311", - "action": "sent", - "amount": 10700, - "fees": 10789, - "time": 1459445798, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90696, - "outputs": [{ - "amount": 10700, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "01459438576264173becd3-58d4-43a6-ba59-8ed3f404cdb7", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459438579, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "f2d474ac2f1e7eefda31ee10ac1d066c779f1ad0ee4d889b6bf40421e6ff2dad", - "action": "sent", - "amount": 10800, - "fees": 10789, - "time": 1459445515, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90658, - "outputs": [{ - "amount": 10800, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "014594394521198be1ffc9-534e-4a97-8686-fdd2d1e3a74e", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459439454, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "cb2630e133815fb3ef657281bc473bb37d47ad74a7505a2c98b4548e5e65240d", - "action": "sent", - "amount": 10200, - "fees": 10789, - "time": 1459439023, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90959, - "outputs": [{ - "amount": 10200, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "0145943285575853dc8430-4d1e-457f-a948-237b07993838", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459432869, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "870cd74f04fa4336beb4e16c9cc98e5a685d96169c06ad38f3c878f41332053c", - "action": "sent", - "amount": 10100, - "fees": 10789, - "time": 1459439023, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90959, - "outputs": [{ - "amount": 10100, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "01459432810452854a20c8-885c-4f35-8580-ee529c969909", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459432818, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "c2e57b795230da721a0a6d2a33df989be40cf461f4561da5f905f1d6c1ed853e", - "action": "sent", - "amount": 10000, - "fees": 10789, - "time": 1459438900, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90962, - "outputs": [{ - "amount": 10000, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "01459432716856b5a9a977-4de9-4beb-b01b-f68ee362efb4", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459432720, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "45a9795ae068b785d6f6e900e03664e0487149fbfd8900eb53781e93f7316f7c", - "action": "sent", - "amount": 10000, - "fees": 15770, - "time": 1459438190, - "addressTo": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "confirmations": 90998, - "outputs": [{ - "amount": 10000, - "address": "mqxPAtiNaoL4ERWN9JfVisfuGpFwACVcJ3", - "message": null - }], - "proposalId": "01459432205652d2c3014b-5a9c-4de3-af24-8f44cbbb4df5", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1459432208, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "c2b3cb6b3637c91cca729edcaaeb4485b4a1c5346f3af556d33379c4b4cb19ac", - "action": "sent", - "amount": 12000, - "fees": 5388, - "time": 1459259755, - "addressTo": "moQ14yiyqWqzahmRZ6KL7GtKyuzqeBT4M9", - "confirmations": 96314, - "outputs": [{ - "amount": 12000, - "address": "moQ14yiyqWqzahmRZ6KL7GtKyuzqeBT4M9", - "message": "{\"iv\":\"XnN6hBRjL4T4n3xpBZ4ZFw==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"eZKrLwXM5sp3RcFXYRbeXTCq2uMJcwAfRVnrSEIkf/msfDDqZu+jNdfznCKuDSYosfA=\"}" - }], - "proposalId": "014592594354211a81a4ff-b6b4-4247-b71e-1c8bfc1ea508", - "creatorName": "me", - "message": "{\"iv\":\"iItl0hV7SXM7quiCBALfog==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"NSh38LEAU9+kkfbYuy8bLFMbVbVv5Z24wuogEwpEHriD1uv6Rf3L15WRHXxBYqvuqys=\"}", - "actions": [{ - "createdOn": 1459259441, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "3e976b19e87be23e013cdb622b98efaa4b2052e6f5c707d0e3457aa58cd523ab", - "action": "received", - "amount": 10000, - "fees": 10000, - "time": 1459259163, - "confirmations": 96315, - "outputs": [{ - "amount": 10000, - "address": "my4e3acTkzvCJgsvyFpggqUb7rfuyG8iEc" - }] - }], - // txhistory 1-1, 2 - '2c4af081dae765e35850747e06643e09d93ac9516e05a929375988b198d69f26': [{ - "txid": "a671aa78b56b7979c916a19c82cdf8cfffd97876484a31a4832fa17c72148542", - "action": "received", - "amount": 100000, - "fees": 10000, - "time": 1459257914, - "confirmations": 96317, - "outputs": [{ - "amount": 100000, - "address": "my4e3acTkzvCJgsvyFpggqUb7rfuyG8iEc" - }] - }, { - "txid": "5dd2c1b857e4992b6c877d9eb741b1f6fa4fc01516220737c0172cd37a26a306", - "action": "sent", - "amount": 100000, - "fees": 2441, - "time": 1458778160, - "addressTo": "mhGs6cXT3wVKcDkfKPB8shjeAEXZEJKoDm", - "confirmations": 120825, - "outputs": [{ - "amount": 100000, - "address": "mhGs6cXT3wVKcDkfKPB8shjeAEXZEJKoDm", - "message": "{\"iv\":\"MdtPv8JanU52VK64K1LAyg==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"09iDO3M5gtJ+QPQTkG+l/8bP3F3CjvNGur5a/XmFKU5gBNjVVM4hdFnabmo9ChfhsTc=\"}" - }], - "proposalId": "01458774041083fede594e-eb57-42fb-89c0-3cbe63f87677", - "creatorName": "me", - "message": "{\"iv\":\"krU7VnmA+HAFzatN2dIHzg==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"IALcaPyp3dT/XsVeeoYlg2ShBkSEJf74LiNA+wSme975rFMbT2KmqJ2nbisoH9Pslqw=\"}", - "actions": [{ - "createdOn": 1458774043, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "4c10410d2e548fb0b3e0b8b003aa989dce3a217b0b4f5a02b7eaf1eec0c0e976", - "action": "sent", - "amount": 10000, - "fees": 2442, - "time": 1458676045, - "addressTo": "mnBXMU5MdHcBNPcptXJPWt8DcA6tBsBxaY", - "confirmations": 121208, - "outputs": [{ - "amount": 10000, - "address": "mnBXMU5MdHcBNPcptXJPWt8DcA6tBsBxaY", - "message": "{\"iv\":\"MsqqMibQPn795kUzd9hbIQ==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"22Y3mhl8jNZuYYap+SyknpTtjZyLPvwWxrAsNOUVCCjYFW2FyHkikMEjdOHrOo1gGeQ=\"}" - }], - "proposalId": "01458670772449704cc37a-6cd1-48e9-b149-33a4f5c8969b", - "creatorName": "me", - "message": "{\"iv\":\"J+M9Yq5w/qvE2QPQj7bBAA==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"wmh2Nc0WR01A7c2F4RX4pTNKyutqNS7ycmzTPR/1qFoa9PxQNxZ0Ayk6bQ7/1OF+CxQ=\"}", - "actions": [{ - "createdOn": 1458670775, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "0bc904d9a5d0302c1e96e83934c5f7bf5e393edf0775357f2d70e8503049ed77", - "action": "received", - "amount": 10000, - "fees": 2442, - "time": 1458673216, - "confirmations": 121222, - "outputs": [{ - "amount": 10000, - "address": "mgT191EgiJ28ZCH5sWNi8CR92yNDeJsK7j" - }] - }, { - "txid": "337996785b7feb3fe1be110be24feb285fbef1f1bc3fd55a1d9982dbcc5b8369", - "action": "received", - "amount": 332200, - "fees": 2580, - "time": 1457100611, - "confirmations": 125404, - "outputs": [{ - "amount": 332200, - "address": "mtADmkGAef8PWbLr6WVw7hPaAWw2D3ZLYH" - }] - }, { - "txid": "b28d2339decd0bff7eae9c8ad3a8b2bb6b699db89984888b07902c51e7e1f9a6", - "action": "received", - "amount": 55600, - "fees": 19604, - "time": 1457099388, - "confirmations": 125406, - "outputs": [{ - "amount": 55600, - "address": "mtADmkGAef8PWbLr6WVw7hPaAWw2D3ZLYH" - }] - }, { - "txid": "a34e25c55cdb5baa413de7087cfe6d0c122167cfe943be91a5e0a666897270de", - "action": "received", - "amount": 500000, - "fees": 19590, - "time": 1457096927, - "confirmations": 125411, - "outputs": [{ - "amount": 500000, - "address": "mtADmkGAef8PWbLr6WVw7hPaAWw2D3ZLYH" - }] - }, { - "txid": "b2d350f67358f1eff5f843eb6632f9f0ed4e3150c03e1f90567046143c6f4e77", - "action": "sent", - "amount": 95000, - "fees": 9275, - "time": 1455826850, - "addressTo": "mgQVwWAddjvKbqQuHbpffhnyhoxiD6Dh58", - "confirmations": 132609, - "outputs": [{ - "amount": 95000, - "address": "mgQVwWAddjvKbqQuHbpffhnyhoxiD6Dh58", - "message": null - }], - "proposalId": "0145582679356996ffe38e-cd23-4b0e-b069-afe2e4d0c0d0", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1455826796, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "f491c4f9fc7d1adb37a2afe9e99ed6024ec61423e456701e1c162d0339486252", - "action": "sent", - "amount": 10000, - "fees": 5725, - "time": 1455826577, - "addressTo": "mpbPujs9h2U8esvzF6GUiQQnaCFtXm8Hfc", - "confirmations": 132614, - "outputs": [{ - "amount": 10000, - "address": "mpbPujs9h2U8esvzF6GUiQQnaCFtXm8Hfc", - "message": null - }], - "proposalId": "014558265370960569d8b7-e9ef-4100-9bd5-41cd992927f1", - "creatorName": "me", - "message": null, - "actions": [{ - "createdOn": 1455826541, - "type": "accept", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "copayerName": "me", - "comment": null - }], - "customData": null - }, { - "txid": "4a0b79d685368ca747ebc735cf506ea9eedb3da4908d900e630351b5717db91e", - "action": "received", - "amount": 20000, - "fees": 5160, - "time": 1455752018, - "confirmations": 135802, - "outputs": [{ - "amount": 20000, - "address": "mk3kXbgkmFEkuo71HKRcCXM1szbA4QN3cn" - }] - }, { - "txid": "b147d0c2714bd1f86203d0cfe5623ed0781806bf914b9439afb8de4ad367ebc7", - "action": "received", - "amount": 100000, - "fees": 6929, - "time": 1455221488, - "confirmations": 163212, - "outputs": [{ - "amount": 100000, - "address": "mk3kXbgkmFEkuo71HKRcCXM1szbA4QN3cn" - }] - }], - // put preferences - 'f25ae222016306f9142ff0ab91151f77045183470df822d283808d077b0bb4c1': {}, - // get preferences - '6ad6c7b8372131a41f4ca547f2119e7d53d2adfd57728f1d5a776db7ebfddb5f': { - "version": "1.0.0", - "createdOn": 1463598797, - "walletId": "66d3afc9-7d76-4b25-850e-aa62fcc53a7d", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "email": null, - "language": "en", - "unit": "bit" - }, -}; diff --git a/test/helpers.js b/test/helpers.js deleted file mode 100644 index 553db161e..000000000 --- a/test/helpers.js +++ /dev/null @@ -1,262 +0,0 @@ -var mocks = {}; - -// UI-Router mock from -// https://gist.github.com/bmwant/4c8e5fee7a539dba69ace42b617d79c3 -mocks.$state = function($q) { - this.expectedTransitions = []; - this.transitionTo = function(stateName) { - if (this.expectedTransitions.length > 0) { - var expectedState = this.expectedTransitions.shift(); - if (expectedState !== stateName) { - throw Error("Expected transition to state: " + expectedState + " but transitioned to " + stateName); - } - } else { - throw Error("No more transitions were expected! Tried to transition to " + stateName); - } - console.log("Mock transition to: " + stateName); - this.current = stateName; - var deferred = $q.defer(); - var promise = deferred.promise; - deferred.resolve(); - return promise; - }; - - this.is = function(name) { - console.log('[helpers.js.24:name:]', name); //TODO - return this.current == name; - }; - this.go = this.transitionTo; - this.expectTransitionTo = function(stateName) { - this.expectedTransitions.push(stateName); - }; - - this.ensureAllTransitionsHappened = function() { - if (this.expectedTransitions.length > 0) { - throw Error("Not all transitions happened!"); - } - }; -}; - -mocks.$timeout = function(cb) { - return cb(); -}; - -mocks.modal = function() {}; -mocks.ongoingProcess = { - set: sinon.stub(), - clear: sinon.stub(), -}; - - -mocks.setProfile = function(profile) {}; -/* - * opts - */ - -var getElements = sinon.stub(); -getElements.returns([]); - -var getElement = sinon.stub(); -getElement.returns({ - getElementsByTagName: getElement, -}); - -mocks.$document = { - getElementById: getElement, -}; - -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()'); - mocks.go = {}; - mocks.go.walletHome = sinon.stub(); - mocks.go.path = sinon.stub(); - mocks.go.is = function(name) { - return mocks.go.current == name - }; - - mocks.notification = { - success: sinon.stub(), - }; - - angular.module('stateMock', []); - angular.module('stateMock').service("$state", mocks.$state.bind()); - - module('ionic'); - module('ngLodash'); - module('angularMoment'); - module('gettext'); - module('stateMock'); - module('bwcModule', function($provide) { - console.log(' * bwcService decorator'); - $provide.decorator('bwcService', function($delegate, lodash) { - var getClient = $delegate.getClient; - - // Fix Encryption IVs - var utils = $delegate.getUtils(); - utils.SJCL.iv = 'BZQVWAP6d1e4G8Fq1rQKbA=='; - - $delegate.getClient = function(walletData, opts) { - - var bwc = new $delegate.Client(); - if (walletData) - bwc.import(walletData, { - baseUrl: opts.bwsurl || 'https://bws.bitpay.com/bws/api', - verbose: opts.verbose, - transports: ['polling'], - }); - - function createHash(method, url, args) { - var headers = JSON.stringify(bwc._getHeaders(method, url, args)); - - // Fixes BWC version... TODO - headers = headers.replace(/bwc-\d+\.\d+\.\d+/, 'bwc-2.4.0') - var x = method + url + JSON.stringify(args) + headers; - var sjcl = $delegate.getSJCL(); - return sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(x)); - }; - - bwc._originalRequest = bwc._doRequest; - - bwc._doGetRequest = function(url, cb) { - url += url.indexOf('?') > 0 ? '&' : '?'; - url += 'r=' + 69321; - return this._doRequest('get', url, {}, cb); - }; - - - // Use fixtures - bwc._doRequest = function(method, url, args, cb2) { - - // find fixed response: - var hash = createHash(method, url, args); - if (lodash.isUndefined(fixtures[hash])) { - console.log('##### UNDEFINED FIXTURED ####:', hash); //TODO - console.log('##### method:', method); //TODO - console.log('##### url :', url); //TODO - console.log('##### args :', JSON.stringify(args)); //TODO - console.log('##### header:', JSON.stringify(bwc._getHeaders(method, url, args))); - - var oldURL = bwc.baseURL; - bwc.baseURL = 'http://localhost:3232/bws/api'; - - console.log('##### running local: to http://localhost:3232/bws/api'); - bwc._originalRequest(method, url, args, function(err, response) { - console.log("### RESPONSE: " + hash + "\n", JSON.stringify(response)); //TODO - bwc.baseURL = oldURL; - return cb2(null, response); - }); - - } else { - console.log('Using fixture: ' + hash.substr(0, 6) + ' for: ' + url); - return cb2(null, fixtures[hash]); - } - }; - - return bwc; - }; - return $delegate; - }); - }); - - module('copayApp.services', { - $modal: mocks.modal, - $timeout: mocks.$timeout, - $state: mocks.$state, - }); - module('copayApp.controllers'); - - inject(function($rootScope, $controller, $injector, lodash, _configService_, _profileService_, _storageService_) { - scope = $rootScope.$new(); - storageService = _storageService_; - - // Set up the mock http service responses - $httpBackend = $injector.get('$httpBackend'); - - // backend definition common for all tests - $httpBackend.when('GET', 'https://bitpay.com/api/rates') - .respond({ - code: "BTC", - name: "Bitcoin", - rate: 1 - }, { - code: "USD", - name: "US Dollar", - 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, - ongoingProcess: mocks.ongoingProcess, - notification: mocks.notification, - configService: _configService_, - profileService: _profileService_, - go: mocks.go, - $document: mocks.$document, - }); - }; - - if (opts.initController) - startController(); - - - if (opts.loadStorage) { - lodash.each(opts.loadStorage, function(v, k) { - localStorage.setItem(k, v); - }); - } - - if (opts.loadProfile) { - - localStorage.setItem('profile', JSON.stringify(opts.loadProfile)); - - _profileService_.loadAndBindProfile(function(err) { - should.not.exist(err, err); - if (!opts.initController) - startController(); - done(); - }); - } else { - if (opts.noProfile){ - return done(); - } - - _profileService_.create({ - noWallet: true - }, function(err) { - should.not.exist(err, err); - if (opts.noDisclaimer){ - return done(); - } - _profileService_.setDisclaimerAccepted(function() { - if (!opts.initController) - startController(); - - done(); - }); - }); - } - }); - }); -}; - -mocks.clear = function(opts, done) { - opts = opts || {}; - - if (!opts.keepStorage) { - // Adds walletService's module dependencies - console.log(' * deleting localstorage'); - localStorage.clear(); - } - - done(); -}; diff --git a/test/karma.conf.js b/test/karma.conf.js deleted file mode 100644 index 8274b222f..000000000 --- a/test/karma.conf.js +++ /dev/null @@ -1,115 +0,0 @@ -// Karma configuration -// Generated on Thu Mar 12 2015 18:13:33 GMT-0300 (ART) - -module.exports = function(config) { - config.set({ - - // base path that will be used to resolve all patterns (eg. files, exclude) - basePath: '..', - - - // frameworks to use - // available frameworks: https://npmjs.org/browse/keyword/karma-adapter - frameworks: ['mocha', 'chai', 'sinon'], - - - // list of files / patterns to load in the browser - files: [ - '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/ionic/release/js/ionic.bundle.js', - 'bower_components/angular-moment/angular-moment.js', - 'bower_components/ng-lodash/build/ng-lodash.js', - 'bower_components/angular-qrcode/angular-qrcode.js', - 'bower_components/angular-gettext/dist/angular-gettext.js', - 'bower_components/ng-csv/build/ng-csv.js', - 'bower_components/ionic-toast/dist/ionic-toast.bundle.min.js', - 'bower_components/angular-clipboard/angular-clipboard.js', - 'bower_components/angular-mocks/angular-mocks.js', - 'angular-pbkdf2/angular-pbkdf2.js', - 'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js', - 'src/js/**/*.js', - 'test/helpers.js', - 'test/**/*.js' - ], - - - // list of files to exclude - exclude: [ - 'src/js/translations.js', - // 'src/js/version.js', - 'test/karma.conf.js', - 'test/old/*' - ], - - client: { - mocha: { - // reporter: 'html', // change Karma's debug.html to the mocha web reporter - ui: 'tdd' - } - }, - - // preprocess matching files before serving them to the browser - // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor - preprocessors: { - 'src/js/**/*.js': ['coverage'] - }, - - - // test results reporter to use - // possible values: 'dots', 'progress' - // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['mocha', 'coverage'], - - // optionally, configure the reporter - coverageReporter: { - dir: 'coverage/', - reporters: [{ - type: 'html', - subdir: 'report-html' - }, { - type: 'lcov', - subdir: 'report-lcov' - }, { - type: 'text-summary' - }] - }, - - // web server port - port: 9876, - - - // enable / disable colors in the output (reporters and logs) - colors: true, - - - // level of logging - // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG - logLevel: config.LOG_INFO, - - - // enable / disable watching file and executing tests whenever any file changes - autoWatch: true, - - - // start these browsers - // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - browsers: ['PhantomJS'], - - plugins: [ - 'karma-mocha-reporter', - 'karma-coverage', - 'karma-mocha', - 'karma-chai', - 'karma-sinon', - 'karma-phantomjs-launcher', - 'karma-chrome-launcher', - ], - - - // Continuous Integration mode - // if true, Karma captures browsers, runs the tests and exits - singleRun: false - }); -}; diff --git a/test/old/controllersSpec.js b/test/old/controllersSpec.js deleted file mode 100644 index f48835b71..000000000 --- a/test/old/controllersSpec.js +++ /dev/null @@ -1,1112 +0,0 @@ -// -// test/unit/controllers/controllersSpec.js -// - -var sinon = require('sinon'); - -// Replace saveAs plugin -saveAs = function(blob, filename) { - saveAsLastCall = { - blob: blob, - filename: filename - }; -}; - -describe("Unit: Controllers", function() { - config.plugins.LocalStorage = true; - config.plugins.GoogleDrive = null; - config.plugins.InsightStorage = null; - config.plugins.EncryptedInsightStorage = null; - - var anAddr = 'mkfTyEk7tfgV611Z4ESwDDSZwhsZdbMpVy'; - var anAmount = 1000; - var aComment = 'hola'; - - - - var invalidForm = { - $invalid: true - }; - - var scope; - var server; - - beforeEach(module('copayApp')); - beforeEach(module('copayApp.controllers')); - beforeEach(module(function($provide) { - $provide.value('request', { - 'get': function(_, cb) { - cb(null, null, [{ - name: 'USD Dollars', - code: 'USD', - rate: 2 - }]); - } - }); - })); - - beforeEach(inject(function($controller, $rootScope) { - scope = $rootScope.$new(); - $rootScope.safeUnspentCount = 1; - - // - // TODO Use the REAL wallet, and stub only networking and DB components! - // - - var w = {}; - w.id = 1234; - w.isComplete = sinon.stub().returns(true); - w.isShared = sinon.stub().returns(true); - w.privateKey = {}; - w.settings = { - unitToSatoshi: 100, - unitDecimals: 2, - alternativeName: 'US Dollar', - alternativeIsoCode: 'USD', - }; - w.addressBook = { - 'juan': '1', - }; - w.totalCopayers = 2; - w.getMyCopayerNickname = sinon.stub().returns('nickname'); - w.getMyCopayerId = sinon.stub().returns('id'); - w.privateKey.toObj = sinon.stub().returns({ - wallet: 'mock' - }); - w.getSecret = sinon.stub().returns('secret'); - w.getName = sinon.stub().returns('fakeWallet'); - w.exportEncrypted = sinon.stub().returns('1234567'); - w.getTransactionHistory = sinon.stub().yields(null); - w.getNetworkName = sinon.stub().returns('testnet'); - - w.spend = sinon.stub().yields(null); - w.sendTxProposal = sinon.stub(); - w.broadcastTx = sinon.stub().yields(null); - w.requiresMultipleSignatures = sinon.stub().returns(true); - w.getTxProposals = sinon.stub().returns([1, 2, 3]); - w.getPendingTxProposals = sinon.stub().returns( - [{ - isPending: true - }] - ); - w.getId = sinon.stub().returns(1234); - w.on = sinon.stub().yields({ - 'e': 'errmsg', - 'loading': false - }); - w.sizes = sinon.stub().returns({ - tota: 1234 - }); - w.getBalance = sinon.stub().returns(10000); - w.publicKeyRing = sinon.stub().yields(null); - w.publicKeyRing.nicknameForCopayer = sinon.stub().returns('nickcopayer'); - w.updateFocusedTimestamp = sinon.stub().returns(1415804323); - w.getAddressesInfo = sinon.stub().returns([{ - addressStr: "2MxvwvfshZxw4SkkaJZ8NDKLyepa9HLMKtu", - isChange: false - }]); - - - var iden = {}; - iden.getLastFocusedWallet = sinon.stub().returns(null); - iden.getWallets = sinon.stub().returns([w]); - iden.getWalletById = sinon.stub().returns(w); - iden.getName = sinon.stub().returns('name'); - iden.deleteWallet = sinon.stub(); - iden.close = sinon.stub().returns(null); - - - $rootScope.wallet = w; - $rootScope.iden = iden; - })); - - describe('Create Controller', function() { - var c; - beforeEach(inject(function($controller, $rootScope) { - scope = $rootScope.$new(); - c = $controller('CreateController', { - $scope: scope, - }); - })); - - describe('#getNumber', function() { - it('should return an array of n undefined elements', function() { - var n = 5; - var array = scope.getNumber(n); - expect(array.length).equal(n); - }); - }); - describe('#create', function() { - it('should work with invalid form', function() { - scope.create(invalidForm); - }); - }); - }); - - - describe('Create Profile Controller', function() { - var c, confService, idenService; - beforeEach(inject(function($controller, $rootScope, configService, identityService) { - scope = $rootScope.$new(); - confService = configService; - idenService = identityService; - c = $controller('CreateProfileController', { - $scope: scope, - }); - })); - - it('should exist', function() { - should.exist(c); - }); - - it('#init', function() { - scope.init(); - }); - - it('#clear', function() { - scope.clear(); - }); - - it('#saveSettings', function() { - var old = confService.set; - confService.set = sinon.stub().returns(null); - scope.saveSettings(); - confService.set.calledOnce.should.be.true; - confService.set = old; - }); - - it('#createProfile', function() { - var old = scope.saveSettings; - scope.saveSettings = sinon.stub().returns(null); - scope.createProfile(); - scope.saveSettings.calledOnce.should.be.true; - scope.saveSettings = old; - }); - - it('#_doCreateProfile', function() { - var old = idenService.create; - idenService.create = sinon.stub().returns(null); - scope._doCreateProfile('myemail@domain.com', 'password'); - idenService.create.calledOnce.should.be.true; - idenService.create = old; - }); - - it('#createDefaultWallet', function() { - var old = idenService.createDefaultWallet; - idenService.createDefaultWallet = sinon.stub().returns(null); - scope.createDefaultWallet(); - idenService.createDefaultWallet.calledOnce.should.be.true; - idenService.createDefaultWallet = old; - }); - - - - }); - - describe('Receive Controller', function() { - var c; - var rootScope; - beforeEach(inject(function($controller, $rootScope) { - rootScope = $rootScope; - scope = $rootScope.$new(); - c = $controller('ReceiveController', { - $scope: scope, - }); - - - var createW = function(N, conf) { - - var c = JSON.parse(JSON.stringify(conf || walletConfig)); - if (!N) N = c.totalCopayers; - - var mainPrivateKey = new copay.PrivateKey({ - networkName: walletConfig.networkName - }); - var mainCopayerEPK = mainPrivateKey.deriveBIP45Branch().extendedPublicKeyString(); - c.privateKey = mainPrivateKey; - - c.publicKeyRing = new copay.PublicKeyRing({ - networkName: c.networkName, - requiredCopayers: Math.min(N, c.requiredCopayers), - totalCopayers: N, - }); - c.publicKeyRing.addCopayer(mainCopayerEPK); - - c.publicKeyRing.getAddressesOrdered = sinon.stub().returns(null); - - c.txProposals = new copay.TxProposals({ - networkName: c.networkName, - }); - - c.blockchain = new Blockchain(walletConfig.blockchain); - - c.network = sinon.stub(); - c.network.setHexNonce = sinon.stub(); - c.network.setHexNonces = sinon.stub(); - c.network.getHexNonce = sinon.stub(); - c.network.getHexNonces = sinon.stub(); - c.network.peerFromCopayer = sinon.stub().returns('xxxx'); - c.network.send = sinon.stub(); - - c.addressBook = { - '2NFR2kzH9NUdp8vsXTB4wWQtTtzhpKxsyoJ': { - label: 'John', - copayerId: '026a55261b7c898fff760ebe14fd22a71892295f3b49e0ca66727bc0a0d7f94d03', - createdTs: 1403102115, - hidden: false - }, - '2MtP8WyiwG7ZdVWM96CVsk2M1N8zyfiVQsY': { - label: 'Jennifer', - copayerId: '032991f836543a492bd6d0bb112552bfc7c5f3b7d5388fcbcbf2fbb893b44770d7', - createdTs: 1403103115, - hidden: false - } - }; - - c.networkName = walletConfig.networkName; - c.version = '0.0.1'; - - c.generateAddress = sinon.stub().returns({}); - - c.balanceInfo = {}; - - return new Wallet(c); - }; - - $rootScope.wallet = createW(); - $rootScope.wallet.balanceInfo = {}; - })); - - it('should exist', function() { - should.exist(c); - }); - - it('#init', function() { - scope.init(); - rootScope.title.should.be.equal('Receive'); - }); - - it('should call setAddressList', function() { - scope.setAddressList(); - expect(scope.addresses).to.be.empty; - scope.toggleShowAll(); - scope.setAddressList(); - expect(scope.addresses).to.be.empty; - }); - - it('#newAddr', function() { - rootScope.wallet.generateAddress = sinon.stub().returns({}); - scope.newAddr(); - rootScope.wallet.generateAddress.calledOnce.should.be.true; - }); - }); - - describe('History Controller', function() { - var ctrl; - beforeEach(inject(function($controller, $rootScope) { - - scope = $rootScope.$new(); - scope.wallet = null; - scope.getTransactions = sinon.stub(); - ctrl = $controller('HistoryController', { - $scope: scope, - }); - })); - - it('should exist', function() { - should.exist(ctrl); - }); - - it('should have a HistoryController controller', function() { - expect(scope.loading).equal(false); - }); - - // this tests has no sense: getTransaction is async - it.skip('should return an empty array of tx from insight', function() { - scope.getTransactions(); - expect(scope.blockchain_txs).to.be.empty; - }); - }); - - - - describe('Profile Controller', function() { - var ctrl, bkpService, idenService; - beforeEach(inject(function($controller, $rootScope, backupService, identityService) { - scope = $rootScope.$new(); - bkpService = backupService; - idenService = identityService; - ctrl = $controller('ProfileController', { - $scope: scope, - }); - })); - - it('should exist', function() { - should.exist(ctrl); - }); - - it('#downloadProfileBackup', function() { - var old = bkpService.profileDownload; - bkpService.profileDownload = sinon.stub().returns(null); - scope.downloadProfileBackup(); - bkpService.profileDownload.calledOnce.should.be.true; - bkpService.profileDownload = old; - }); - - it('#viewProfileBackup', function() { - var old = bkpService.profileEncrypted; - bkpService.profileEncrypted = sinon.stub().returns(null); - scope.viewProfileBackup(); - //bkpService.profileEncrypted.calledOnce.should.be.true; - bkpService.profileEncrypted = old; - }); - - it('#copyProfileBackup', function() { - var old = bkpService.profileEncrypted; - bkpService.profileEncrypted = sinon.stub().returns(null); - - window.cordova = { - plugins: { - clipboard: { - copy: function(e) { - return e; - } - } - } - }; - - window.plugins = { - toast: { - showShortCenter: function(e) { - return e; - } - } - }; - - scope.copyProfileBackup(); - bkpService.profileEncrypted.calledOnce.should.be.true; - bkpService.profileEncrypted = old; - }); - - it('#sendProfileBackup', function() { - var old = bkpService.profileEncrypted; - bkpService.profileEncrypted = sinon.stub().returns(null); - - window.plugin = { - email: { - open: function(e) { - return e; - } - } - }; - - window.plugins = { - toast: { - showShortCenter: function(e) { - return e; - } - } - }; - - scope.sendProfileBackup(); - bkpService.profileEncrypted.calledOnce.should.be.true; - bkpService.profileEncrypted = old; - }); - - it('#deleteProfile', function() { - var old = idenService.deleteProfile; - idenService.deleteProfile = sinon.stub().returns(null); - scope.deleteProfile(); - idenService.deleteProfile.calledOnce.should.be.true; - idenService.deleteProfile = old; - }); - - - }); - - - - describe('Send Controller', function() { - var scope, form, sendForm, sendCtrl, rootScope; - beforeEach(angular.mock.inject(function($compile, $rootScope, $controller, rateService, notification) { - scope = $rootScope.$new(); - rootScope = $rootScope; - scope.rateService = rateService; - var element = angular.element( - '
' + - '' + - '' + - '
' - ); - scope.model = { - newaddress: null, - newlabel: null, - _address: null, - _amount: null - }; - $compile(element)(scope); - - var element2 = angular.element( - '
' + - '' + - '' + - '' + - '' + - '
' - ); - $compile(element2)(scope); - sendCtrl = $controller('SendController', { - $scope: scope, - $modal: {}, - }); - scope.init(); - scope.$digest(); - form = scope.form; - sendForm = scope.form2; - scope.sendForm = sendForm; - })); - - it('should have a SendController controller', function() { - should.exist(scope.submitForm); - }); - - it('should have a title', function() { - expect(scope.title); - }); - - it('#setError', function() { - scope.setError('my error'); - expect(scope.error); - }); - - it('#setFromPayPro', function() { - var old = rootScope.wallet.fetchPaymentRequest - rootScope.wallet.fetchPaymentRequest = sinon.stub().returns(null); - scope.setFromPayPro('newURL'); - rootScope.wallet.fetchPaymentRequest.calledOnce.should.be.true; - rootScope.wallet.fetchPaymentRequest = old; - }); - - - - it('should validate address with network', function() { - form.newaddress.$setViewValue('mkfTyEk7tfgV611Z4ESwDDSZwhsZdbMpVy'); - expect(form.newaddress.$invalid).to.equal(false); - }); - - it('should not validate address with other network', function() { - form.newaddress.$setViewValue('1JqniWpWNA6Yvdivg3y9izLidETnurxRQm'); - expect(form.newaddress.$invalid).to.equal(true); - }); - - it('should not validate random address', function() { - form.newaddress.$setViewValue('thisisaninvalidaddress'); - expect(form.newaddress.$invalid).to.equal(true); - }); - - it('should validate label', function() { - form.newlabel.$setViewValue('John'); - expect(form.newlabel.$invalid).to.equal(false); - }); - - it('should not validate label', function() { - expect(form.newlabel.$invalid).to.equal(true); - }); - - it('should create a transaction proposal with given values', inject(function($timeout) { - sendForm.address.$setViewValue(anAddr); - sendForm.amount.$setViewValue(anAmount); - sendForm.comment.$setViewValue(aComment); - - var w = scope.wallet; - scope.submitForm(sendForm); - - $timeout.flush(); - sinon.assert.callCount(w.spend, 1); - sinon.assert.callCount(w.broadcastTx, 0); - var spendArgs = w.spend.getCall(0).args[0]; - spendArgs.toAddress.should.equal(anAddr); - spendArgs.amountSat.should.equal(anAmount * scope.wallet.settings.unitToSatoshi); - spendArgs.comment.should.equal(aComment); - })); - - - it('should handle big values in 100 BTC', inject(function($timeout) { - var old = scope.wallet.settings.unitToSatoshi; - scope.wallet.settings.unitToSatoshi = 100000000; - sendForm.address.$setViewValue(anAddr); - sendForm.amount.$setViewValue(100); - sendForm.address.$setViewValue(anAddr); - - scope.updateTxs = sinon.spy(); - scope.submitForm(sendForm); - var w = scope.wallet; - $timeout.flush(); - w.spend.getCall(0).args[0].amountSat.should.equal(100 * scope.wallet.settings.unitToSatoshi); - scope.wallet.settings.unitToSatoshi = old; - })); - - - it('should handle big values in 5000 BTC', inject(function($rootScope, $timeout) { - var w = scope.wallet; - w.requiresMultipleSignatures = sinon.stub().returns(true); - - - var old = $rootScope.wallet.settings.unitToSatoshi; - $rootScope.wallet.settings.unitToSatoshi = 100000000; - sendForm.address.$setViewValue(anAddr); - sendForm.amount.$setViewValue(5000); - scope.submitForm(sendForm); - $timeout.flush(); - - w.spend.getCall(0).args[0].amountSat.should.equal(5000 * $rootScope.wallet.settings.unitToSatoshi); - $rootScope.wallet.settings.unitToSatoshi = old; - })); - - it('should convert bits amount to fiat', function(done) { - scope.rateService.whenAvailable(function() { - sendForm.amount.$setViewValue(1e6); - scope.$digest(); - expect(scope._amount).to.equal(1e6); - expect(scope.__alternative).to.equal(2); - done(); - }); - }); - it('should convert fiat to bits amount', function(done) { - scope.rateService.whenAvailable(function() { - sendForm.alternative.$setViewValue(2); - scope.$digest(); - expect(scope.__alternative).to.equal(2); - expect(scope._amount).to.equal(1e6); - done(); - }); - }); - - it('receive from uri using bits', inject(function() { - sendForm.address.$setViewValue('bitcoin:mxf5psDyA8EQVzb2MZ7MkDWiXuAuWWCRMB?amount=1.018085'); - expect(sendForm.amount.$modelValue).to.equal(1018085); - sendForm.address.$setViewValue('bitcoin:mxf5psDyA8EQVzb2MZ7MkDWiXuAuWWCRMB?amount=1.01808500'); - expect(sendForm.amount.$modelValue).to.equal(1018085); - sendForm.address.$setViewValue('bitcoin:mxf5psDyA8EQVzb2MZ7MkDWiXuAuWWCRMB?amount=0.29133585'); - expect(sendForm.amount.$modelValue).to.equal(291335.85); - })); - - it('receive from uri using BTC', inject(function($rootScope) { - var old = $rootScope.wallet.settings.unitToSatoshi; - var old_decimals = $rootScope.wallet.settings.unitDecimals; - $rootScope.wallet.settings.unitToSatoshi = 100000000; - $rootScope.wallet.settings.unitDecimals = 8; - sendForm.address.$setViewValue('bitcoin:mxf5psDyA8EQVzb2MZ7MkDWiXuAuWWCRMB?amount=1.018085'); - expect(sendForm.amount.$modelValue).to.equal(1.018085); - sendForm.address.$setViewValue('bitcoin:mxf5psDyA8EQVzb2MZ7MkDWiXuAuWWCRMB?amount=1.01808500'); - expect(sendForm.amount.$modelValue).to.equal(1.018085); - sendForm.address.$setViewValue('bitcoin:mxf5psDyA8EQVzb2MZ7MkDWiXuAuWWCRMB?amount=0.29133585'); - expect(sendForm.amount.$modelValue).to.equal(0.29133585); - sendForm.address.$setViewValue('bitcoin:mxf5psDyA8EQVzb2MZ7MkDWiXuAuWWCRMB?amount=0.1'); - expect(sendForm.amount.$modelValue).to.equal(0.1); - $rootScope.wallet.settings.unitToSatoshi = old; - $rootScope.wallet.settings.unitDecimals = old_decimals; - })); - }); - - describe("Unit: Version Controller", function() { - var scope, $httpBackendOut; - var GH = 'https://api.github.com/repos/bitpay/copay/tags'; - beforeEach(inject(function($controller, $injector) { - $httpBackend = $injector.get('$httpBackend'); - $httpBackend.when('GET', GH) - .respond([{ - name: "v100.1.6", - zipball_url: "https://api.github.com/repos/bitpay/copay/zipball/v0.0.6", - tarball_url: "https://api.github.com/repos/bitpay/copay/tarball/v0.0.6", - commit: { - sha: "ead7352bf2eca705de58d8b2f46650691f2bc2c7", - url: "https://api.github.com/repos/bitpay/copay/commits/ead7352bf2eca705de58d8b2f46650691f2bc2c7" - } - }]); - })); - - var rootScope; - beforeEach(inject(function($controller, $rootScope) { - rootScope = $rootScope; - scope = $rootScope.$new(); - headerCtrl = $controller('VersionController', { - $scope: scope, - }); - })); - - afterEach(function() { - $httpBackend.verifyNoOutstandingExpectation(); - $httpBackend.verifyNoOutstandingRequest(); - }); - - - - it('should hit github for version', function() { - $httpBackend.expectGET(GH); - scope.$apply(); - $httpBackend.flush(); - }); - - it('should check version ', inject(function($injector) { - notification = $injector.get('notification'); - var spy = sinon.spy(notification, 'version'); - $httpBackend.expectGET(GH); - scope.$apply(); - $httpBackend.flush(); - spy.calledOnce.should.equal(true); - })); - - it('should check blockChainStatus', function() { - $httpBackend.expectGET(GH); - $httpBackend.flush(); - rootScope.insightError = 1; - scope.$apply(); - expect(rootScope.insightError).equal(1); - scope.$apply(); - expect(rootScope.insightError).equal(1); - scope.$apply(); - }); - }); - - describe("Unit: Sidebar Controller", function() { - beforeEach(inject(function($controller, $rootScope) { - rootScope = $rootScope; - scope = $rootScope.$new(); - headerCtrl = $controller('SidebarController', { - $scope: scope, - }); - })); - - it('should call sign out', function() { - scope.signout(); - rootScope.iden.close.calledOnce.should.be.true; - }); - }); - - describe("Head Controller", function() { - var scope, ctrl, rootScope, idenService, balService; - beforeEach(inject(function($controller, $rootScope, identityService, balanceService) { - rootScope = $rootScope; - idenService = identityService; - balService = balanceService; - scope = $rootScope.$new(); - ctrl = $controller('HeadController', { - $scope: scope, - }); - })); - - it('should exist', function() { - should.exist(ctrl); - }); - - it('should call sign out', function() { - var old = idenService.signout; - idenService.signout = sinon.stub().returns(null); - scope.signout(); - idenService.signout.calledOnce.should.be.true; - idenService.signout = old; - }); - - it('should call refresh', function() { - var old = rootScope.wallet.sendWalletReady; - rootScope.wallet.sendWalletReady = sinon.stub().returns(null); - balService.clearBalanceCache = sinon.stub().returns(null); - scope.refresh(); - rootScope.wallet.sendWalletReady.calledOnce.should.be.true; - rootScope.wallet.sendWalletReady = old; - }); - - }); - - describe('Send Controller', function() { - var sendCtrl, form; - beforeEach(inject(function($compile, $rootScope, $controller) { - scope = $rootScope.$new(); - $rootScope.availableBalance = 123456; - - var element = angular.element( - '
' + - '' + - '
' - ); - scope.model = { - amount: null - }; - $compile(element)(scope); - scope.$digest(); - form = scope.form; - - sendCtrl = $controller('SendController', { - $scope: scope, - $modal: {}, - }); - })); - - it('should have a SendController', function() { - expect(scope.isMobile).not.to.equal(null); - }); - it('should autotop balance correctly', function() { - scope.setTopAmount(form); - form.amount.$setViewValue(123356); - expect(scope.amount).to.equal(123356); - expect(form.amount.$invalid).to.equal(false); - expect(form.amount.$pristine).to.equal(false); - }); - }); - - describe('Import Controller', function() { - var ctrl; - beforeEach(inject(function($controller, $rootScope) { - scope = $rootScope.$new(); - ctrl = $controller('ImportController', { - $scope: scope, - }); - })); - - it('should exist', function() { - should.exist(ctrl); - }); - it('import status', function() { - expect(scope.importStatus).equal('Importing wallet - Reading backup...'); - }); - }); - - // TODO: fix this test - describe.skip('Home Controller', function() { - var ctrl; - beforeEach(inject(function($controller, $rootScope) { - scope = $rootScope.$new(); - ctrl = $controller('HomeController', { - $scope: scope, - }); - })); - - it('should exist', function() { - should.exist(ctrl); - }); - describe('#open', function() { - it('should work with invalid form', function() { - scope.open(invalidForm); - }); - }); - }); - - describe('SignOut Controller', function() { - var ctrl; - beforeEach(inject(function($controller, $rootScope) { - scope = $rootScope.$new(); - ctrl = $controller('signOutController', { - $scope: scope, - }); - })); - - it('should exist', function() { - should.exist(ctrl); - }); - }); - - describe('Settings Controller', function() { - var what; - beforeEach(inject(function($controller, $rootScope) { - scope = $rootScope.$new(); - what = $controller('SettingsController', { - $scope: scope, - }); - })); - - it('should exist', function() { - should.exist(what); - }); - }); - - describe('Copayers Controller', function() { - var saveDownload = null; - var ctrl, rootScope, idenService; - beforeEach(inject(function($controller, $rootScope, identityService) { - scope = $rootScope.$new(); - rootScope = $rootScope; - idenService = identityService; - ctrl = $controller('CopayersController', { - $scope: scope, - $modal: {}, - }); - })); - - it('should exist', function() { - should.exist(ctrl); - }); - - it('#init', function() { - var old = scope.updateList; - scope.updateList = sinon.stub().returns(null); - scope.init(); - scope.updateList.callCount.should.be.equal(3); //why 3 ?????? - scope.updateList = old; - }); - - it('#updateList', function() { - var old = rootScope.wallet.getRegisteredPeerIds; - rootScope.wallet.getRegisteredPeerIds = sinon.stub().returns(null); - rootScope.wallet.removeListener = sinon.stub().returns(null); - scope.updateList(); - rootScope.wallet.getRegisteredPeerIds.callCount.should.be.equal(1); - rootScope.wallet.getRegisteredPeerIds = old; - }); - - it('#deleteWallet', inject(function($timeout) { - var old = idenService.deleteWallet; - idenService.deleteWallet = sinon.stub().returns(null); - scope.deleteWallet(); - $timeout.flush(); - idenService.deleteWallet.callCount.should.be.equal(1); - idenService.deleteWallet = old; - })); - - }); - - describe('Join Controller', function() { - var ctrl; - beforeEach(inject(function($controller, $rootScope) { - scope = $rootScope.$new(); - ctrl = $controller('JoinController', { - $scope: scope, - }); - })); - - it('should exist', function() { - should.exist(ctrl); - }); - describe('#join', function() { - it('should work with invalid form', function() { - scope.join(invalidForm); - }); - }); - }); - - describe('paymentUriController Controller', function() { - var what; - beforeEach(inject(function($controller, $rootScope, $location) { - scope = $rootScope.$new(); - var routeParams = { - data: 'bitcoin:19mP9FKrXqL46Si58pHdhGKow88SUPy1V8' - }; - var query = { - amount: 0.1, - message: "a bitcoin donation" - }; - what = $controller('paymentUriController', { - $scope: scope, - $routeParams: routeParams, - $location: { - search: function() { - return query; - } - } - }); - })); - - it('should exist', function() { - should.exist(what); - }); - - it('should parse url correctly', function() { - should.exist(what); - should.exist(scope.pendingPayment); - scope.pendingPayment.should.equal('bitcoin:19mP9FKrXqL46Si58pHdhGKow88SUPy1V8?amount=0.1&message=a bitcoin donation'); - }); - }); - - describe('Warning Controller', function() { - var ctrl, idenService; - beforeEach(inject(function($controller, $rootScope, identityService) { - scope = $rootScope.$new(); - idenService = identityService; - ctrl = $controller('WarningController', { - $scope: scope, - }); - })); - - it('should exist', function() { - should.exist(ctrl); - }); - - it('#signout', function() { - var old = idenService.signout; - idenService.signout = sinon.stub().returns(null); - scope.signout(); - idenService.signout.calledOnce.should.be.true; - idenService.signout = old; - }); - - }); - - describe('More Controller', function() { - var ctrl, modalCtrl, rootScope, idenService, bkpService; - beforeEach(inject(function($controller, $rootScope, backupService, identityService) { - scope = $rootScope.$new(); - rootScope = $rootScope; - idenService = identityService; - bkpService = backupService; - ctrl = $controller('MoreController', { - $scope: scope - }); - saveAsLastCall = null; - - })); - - it('Backup Wallet controller #download', function() { - var w = scope.wallet; - expect(saveAsLastCall).equal(null); - scope.downloadWalletBackup(); - - expect(saveAsLastCall.blob.size).equal(7); - expect(saveAsLastCall.blob.type).equal('text/plain;charset=utf-8'); - }); - - it('Backup Wallet controller should name backup correctly for multiple copayers', function() { - var w = scope.wallet; - expect(saveAsLastCall).equal(null); - scope.downloadWalletBackup(); - expect(saveAsLastCall.filename).equal('nickname-fakeWallet-keybackup.json.aes'); - }); - - it('Backup Wallet controller should name backup correctly for 1-1 wallet', function() { - var w = scope.wallet; - expect(saveAsLastCall).equal(null); - scope.wallet.totalCopayers = 1; - scope.downloadWalletBackup(); - expect(saveAsLastCall.filename).equal('fakeWallet-keybackup.json.aes'); - }); - - it('Delete a wallet', inject(function($timeout) { - var w = scope.wallet; - - scope.deleteWallet(); - $timeout.flush(); - scope.$digest(); - scope.iden.deleteWallet.calledOnce.should.equal(true); - scope.iden.deleteWallet.getCall(0).args[0].should.equal(w.getId()); - })); - - it('#save', function() { - var old = rootScope.wallet.changeSettings; - rootScope.wallet.changeSettings = sinon.stub().returns(null); - scope.selectedUnit = {}; - scope.save(); - rootScope.wallet.changeSettings.calledOnce.should.equal.true; - rootScope.wallet.changeSettings = old; - }); - - it('#purge checking balance', function() { - var old = rootScope.wallet.purgeTxProposals; - rootScope.wallet.purgeTxProposals = sinon.stub().returns(true); - scope.purge(); - rootScope.wallet.purgeTxProposals.calledOnce.should.equal.true; - rootScope.wallet.purgeTxProposals = old; - }); - - it('#purge without checking balance', function() { - var old = rootScope.wallet.purgeTxProposals; - rootScope.wallet.purgeTxProposals = sinon.stub().returns(false); - scope.purge(); - rootScope.wallet.purgeTxProposals.calledOnce.should.equal.true; - rootScope.wallet.purgeTxProposals = old; - }); - - it('#updateIndexes', function() { - var old = rootScope.wallet.purgeTxProposals; - rootScope.wallet.updateIndexes = sinon.stub().yields(); - scope.updateIndexes(); - rootScope.wallet.updateIndexes.calledOnce.should.equal.true; - rootScope.wallet.updateIndexes = old; - }); - - it('#updateIndexes return error', function() { - var old = rootScope.wallet.purgeTxProposals; - rootScope.wallet.updateIndexes = sinon.stub().yields('error'); - scope.updateIndexes(); - rootScope.wallet.updateIndexes.calledOnce.should.equal.true; - rootScope.wallet.updateIndexes = old; - }); - - it('#deleteWallet', inject(function($timeout) { - var old = idenService.deleteWallet; - idenService.deleteWallet = sinon.stub().yields(null); - scope.deleteWallet(); - $timeout.flush(); - idenService.deleteWallet.calledOnce.should.equal.true; - scope.loading.should.be.false; - idenService.deleteWallet = old; - })); - - it('#deleteWallet with error', inject(function($timeout) { - var old = idenService.deleteWallet; - idenService.deleteWallet = sinon.stub().yields('error'); - scope.deleteWallet(); - $timeout.flush(); - idenService.deleteWallet.calledOnce.should.equal.true; - scope.error.should.be.equal('error'); - idenService.deleteWallet = old; - })); - - it('#viewWalletBackup', function() { - var old = bkpService.walletEncrypted; - bkpService.walletEncrypted = sinon.stub().returns('backup0001'); - scope.viewWalletBackup(); - bkpService.walletEncrypted.calledOnce.should.equal.true; - bkpService.walletEncrypted = old; - }); - - it('#copyWalletBackup', function() { - var old = bkpService.walletEncrypted; - bkpService.walletEncrypted = sinon.stub().returns('backup0001'); - window.cordova = { - plugins: { - clipboard: { - copy: function(e) { - return e; - } - } - } - }; - - window.plugins = { - toast: { - showShortCenter: function(e) { - return e; - } - } - }; - scope.copyWalletBackup(); - bkpService.walletEncrypted.calledOnce.should.equal.true; - bkpService.walletEncrypted = old; - }); - - it('#sendWalletBackup', function() { - var old = bkpService.walletEncrypted; - bkpService.walletEncrypted = sinon.stub().returns('backup0001'); - - window.plugins = { - toast: { - showShortCenter: function(e) { - return e; - } - } - }; - - window.plugin = { - email: { - open: function(e) { - return e; - } - } - }; - scope.sendWalletBackup(); - bkpService.walletEncrypted.calledOnce.should.equal.true; - bkpService.walletEncrypted = old; - }); - - }); - -}); diff --git a/test/old/directivesSpec.js b/test/old/directivesSpec.js deleted file mode 100644 index 507e3c159..000000000 --- a/test/old/directivesSpec.js +++ /dev/null @@ -1,250 +0,0 @@ -'use strict'; -// -// test/unit/directives/directivesSpec.js -// -describe("Unit: Testing Directives", function() { - - var $scope, form; - - beforeEach(module('copayApp.directives')); - beforeEach(inject(function($rootScope) { - - var w = {}; - w.isComplete = sinon.stub().returns(true); - w.privateKey = {}; - w.settings = { - unitToSatoshi: 100, - unitDecimals: 2, - alternativeName: 'US Dollar', - alternativeIsoCode: 'USD', - }; - w.addressBook = { - 'juan': '1', - }; - w.totalCopayers = 2; - w.getMyCopayerNickname = sinon.stub().returns('nickname'); - w.getMyCopayerId = sinon.stub().returns('id'); - w.privateKey.toObj = sinon.stub().returns({ - wallet: 'mock' - }); - w.getSecret = sinon.stub().returns('secret'); - w.getName = sinon.stub().returns('fakeWallet'); - w.exportEncrypted = sinon.stub().returns('1234567'); - w.getTransactionHistory = sinon.stub().yields({}); - w.getNetworkName = sinon.stub().returns('testnet'); - - w.createTx = sinon.stub().yields(null); - w.sendTx = sinon.stub().yields(null); - w.requiresMultipleSignatures = sinon.stub().returns(true); - w.getTxProposals = sinon.stub().returns([1,2,3]); - $rootScope.wallet = w; - })); - - describe('Validate Address', function() { - beforeEach(inject(function($compile, $rootScope) { - $scope = $rootScope; - var element = angular.element( - '
' + - '' + - '
' - ); - $scope.model = { - address: null - }; - $compile(element)($scope); - $scope.$digest(); - form = $scope.form; - })); - - it('should validate with network', inject(function($rootScope) { - $rootScope.wallet.getNetworkName = sinon.stub().returns('testnet'); - form.address.$setViewValue('mkfTyEk7tfgV611Z4ESwDDSZwhsZdbMpVy'); - expect(form.address.$invalid).to.equal(false); - })); - it('should not validate with other network', inject(function($rootScope) { - $rootScope.wallet.getNetworkName = sinon.stub().returns('livenet'); - form.address.$setViewValue('mkfTyEk7tfgV611Z4ESwDDSZwhsZdbMpVy'); - expect(form.address.$invalid).to.equal(true); - })); - it('should not validate random', function() { - form.address.$setViewValue('thisisaninvalidaddress'); - expect(form.address.$invalid).to.equal(true); - }); - }); - - describe('Validate Amount', function() { - describe('Unit: bits', function() { - beforeEach(inject(function($compile, $rootScope) { - $scope = $rootScope; - var element = angular.element( - '
' + - '' + - '
' - ); - $scope.model = { - amount: null - }; - $compile(element)($scope); - $scope.$digest(); - form = $scope.form; - })); - it('should validate', function() { - form.amount.$setViewValue(100); - expect(form.amount.$invalid).to.equal(false); - form.amount.$setViewValue(800); - expect(form.amount.$invalid).to.equal(false); - form.amount.$setViewValue(900); - - }); - - it('should not validate', function() { - form.amount.$setViewValue(0); - expect(form.amount.$invalid).to.equal(true); - form.amount.$setViewValue(999999999999); - expect(form.amount.$invalid).to.equal(true); - }); - }); - - describe('Unit: BTC', function() { - beforeEach(inject(function($compile, $rootScope) { - $scope = $rootScope; - var w = $rootScope.wallet; - w.settings.unitToSatoshi = 100000000; - w.settings.unitName = 'BTC'; - w.settings.unitDecimals = 8; - - $rootScope.availableBalance = 0.04; - var element = angular.element( - '
' + - '' + - '
' - ); - $scope.model = { - amount: null - }; - $compile(element)($scope); - $scope.$digest(); - form = $scope.form; - })); - - it('should validate', function() { - form.amount.$setViewValue(0.01); - expect(form.amount.$invalid).to.equal(false); - form.amount.$setViewValue(0.039); - expect(form.amount.$invalid).to.equal(false); - form.amount.$setViewValue(100292.039); - expect(form.amount.$invalid).to.equal(false); - }); - - it('should not validate', function() { - form.amount.$setViewValue(0.039998888888888); - expect(form.amount.$invalid).to.equal(true); - form.amount.$setViewValue(0); - expect(form.amount.$invalid).to.equal(true); - form.amount.$setViewValue(0.0); - expect(form.amount.$invalid).to.equal(true); - }); - - }); - - }); - - describe('Contact directive', function() { - var element1, element2; - - beforeEach(inject(function($compile, $rootScope) { - $rootScope.wallet = { - addressBook: { - '2MtBXKLtZuXGDshUcyH6yq7aZ33Snbb49pT': { - label: ':)' - } - } - } - element1 = angular.element( - '' - ); - element2 = angular.element( - '' - ); - $compile(element1)($rootScope); - $compile(element2)($rootScope); - $rootScope.$digest(); - })); - - it('should replace the content', function() { - expect(element1.html()).to.equal(':)'); - expect(element2.html()).to.equal('2MvCKdnwEMiaexi247gi738U6pwUFZxbhXn'); - }); - - }); - - describe('Password strength', function() { - beforeEach(inject(function($compile, $rootScope) { - $scope = $rootScope; - var element = angular.element( - '' - ); - $compile(element)($scope); - $scope.$digest(); - })); - - it('should check very weak password', function() { - $scope.password = 'asd'; - $scope.$digest(); - expect($scope.passwordStrength.strength).to.equal(1); - }); - - - it('should check weak password', function() { - $scope.password = 'asdasdASDASD'; - $scope.$digest(); - expect($scope.passwordStrength.message).to.equal('Weak, add numerals'); - }); - - it('should check medium password', function() { - $scope.password = 'asdasdA1'; - $scope.$digest(); - expect($scope.passwordStrength.message).to.equal('Medium, add punctuation'); - }); - - it('should check strong password', function() { - $scope.password = 'asdasdASDASD1{'; - $scope.$digest(); - expect($scope.passwordStrength.message).to.equal('Strong, add punctuation'); - }); - - }); - - describe('Match Password Inputs', function() { - beforeEach(inject(function($compile, $rootScope) { - $scope = $rootScope; - $rootScope.availableBalance = 1000; - var element = angular.element( - '
' + - '' + - '' + - '
' - ); - $scope.model = { - walletPassword: null, - walletPasswordConfirm: null - }; - $compile(element)($scope); - $scope.$digest(); - form = $scope.form; - })); - it('should not validate', function() { - form.walletPassword.$setViewValue('mysecretpassword'); - form.walletPasswordConfirm.$setViewValue('mySecretPassword'); - $scope.$digest(); - expect(form.walletPasswordConfirm.$invalid).to.equal(true); - }); - it('should validate', function() { - form.walletPassword.$setViewValue('mysecretpassword123'); - form.walletPasswordConfirm.$setViewValue('mysecretpassword123'); - $scope.$digest(); - expect(form.walletPasswordConfirm.$invalid).to.equal(false); - }); - }); - -}); diff --git a/test/old/filtersSpec.js b/test/old/filtersSpec.js deleted file mode 100644 index 43bab46f5..000000000 --- a/test/old/filtersSpec.js +++ /dev/null @@ -1,168 +0,0 @@ -'use strict'; -// -// test/unit/filters/filtersSpec.js -// -describe('Angular Filters', function() { - - beforeEach(angular.mock.module('copayApp')); - beforeEach(module('copayApp.filters')); - beforeEach(inject(function($rootScope) { - - var w = {}; - w.isComplete = sinon.stub().returns(true); - w.privateKey = {}; - w.settings = { - unitToSatoshi: 100, - unitDecimals: 2, - alternativeName: 'US Dollar', - alternativeIsoCode: 'USD', - }; - w.addressBook = { - 'juan': '1', - }; - w.balanceByAddr = [{ - 'address1': 1 - }]; - - w.totalCopayers = 2; - w.getMyCopayerNickname = sinon.stub().returns('nickname'); - w.getMyCopayerId = sinon.stub().returns('id'); - w.privateKey.toObj = sinon.stub().returns({ - wallet: 'mock' - }); - w.getSecret = sinon.stub().returns('secret'); - w.getName = sinon.stub().returns('fakeWallet'); - w.getId = sinon.stub().returns('id'); - w.exportEncrypted = sinon.stub().returns('1234567'); - w.getTransactionHistory = sinon.stub().yields({}); - w.getNetworkName = sinon.stub().returns('testnet'); - w.getAddressesInfo = sinon.stub().returns({}); - - w.createTx = sinon.stub().yields(null); - w.sendTx = sinon.stub().yields(null); - w.requiresMultipleSignatures = sinon.stub().returns(true); - w.getTxProposals = sinon.stub().returns([1, 2, 3]); - $rootScope.wallet = w; - })); - - - - - - - var walletConfig = { - requiredCopayers: 3, - totalCopayers: 5, - spendUnconfirmed: 1, - reconnectDelay: 100, - networkName: 'testnet', - alternativeName: 'lol currency', - alternativeIsoCode: 'LOL' - }; - - - - describe('removeEmpty addresses', function() { - it('should work with empty lists', inject(function($filter) { - var removeEmpty = $filter('removeEmpty'); - expect(removeEmpty([]).length).to.equal(0); - })); - - it('should work with undefined', inject(function($filter) { - var removeEmpty = $filter('removeEmpty'); - expect(removeEmpty(undefined).length).to.equal(0); - })); - - it('should filter empty change addresses from other copayers', inject(function($filter) { - var removeEmpty = $filter('removeEmpty'); - var addresses = [{ - owned: true, - isChange: false, - balance: 0 - }, { - owned: false, - isChange: false, - balance: 0 - }, { - owned: true, - isChange: true, - balance: 0 - }, { - owned: false, - isChange: true, - balance: 0 - }]; - expect(removeEmpty(addresses).length).to.equal(2); - })); - }); - - describe('noFractionNumber', function() { - describe('noFractionNumber bits', function() { - beforeEach(inject(function($rootScope) { - var w = $rootScope.wallet; - w.settings.unitToSatoshi = 100; - w.settings.unitName = 'bits'; - })); - it('should format number to display correctly', inject(function($filter) { - var noFraction = $filter('noFractionNumber'); - expect(noFraction(3100)).to.equal('3,100'); - expect(noFraction(3100200)).to.equal('3,100,200'); - expect(noFraction(3)).to.equal('3'); - expect(noFraction(0.3)).to.equal(0.3); - expect(noFraction(0.30000000)).to.equal(0.3); - expect(noFraction(3200.01)).to.equal('3,200.01'); - expect(noFraction(3200890.010000)).to.equal('3,200,890.01'); - })); - }); - - describe('noFractionNumber BTC', function() { - beforeEach(inject(function($rootScope) { - var w = $rootScope.wallet; - w.settings.unitToSatoshi = 100000000; - w.settings.unitName = 'BTC'; - })); - it('should format number to display correctly', inject(function($filter) { - var noFraction = $filter('noFractionNumber'); - expect(noFraction(0.30000000)).to.equal(0.3); - expect(noFraction(0.00302000)).to.equal(0.00302); - expect(noFraction(1.00000001)).to.equal(1.00000001); - expect(noFraction(3.10000012)).to.equal(3.10000012); - expect(noFraction(0.00100000)).to.equal(0.001); - expect(noFraction(0.00100009)).to.equal(0.00100009); - expect(noFraction(2000.00312011)).to.equal('2,000.00312011'); - expect(noFraction(2000998.00312011)).to.equal('2,000,998.00312011'); - })); - }); - - describe('noFractionNumber mBTC', function() { - beforeEach(inject(function($rootScope) { - var w = $rootScope.wallet; - w.settings.unitToSatoshi = 100000; - w.settings.unitName = 'mBTC'; - })); - it('should format number to display correctly', inject(function($filter) { - var noFraction = $filter('noFractionNumber'); - expect(noFraction(0.30000)).to.equal(0.3); - expect(noFraction(0.00302)).to.equal(0.00302); - expect(noFraction(1.00001)).to.equal(1.00001); - expect(noFraction(3.10002)).to.equal(3.10002); - expect(noFraction(0.00100000)).to.equal(0.001); - expect(noFraction(0.00100009)).to.equal(0.001); - expect(noFraction(2000.00312)).to.equal('2,000.00312'); - expect(noFraction(2000998.00312)).to.equal('2,000,998.00312'); - })); - }); - - describe('noFractionNumber:custom fractionSize', function() { - it('should format number to display correctly', inject(function($filter) { - var noFraction = $filter('noFractionNumber'); - expect(noFraction(0.30000, 0)).to.equal('0'); - expect(noFraction(1.00001, 0)).to.equal('1'); - expect(noFraction(3.10002, 0)).to.equal('3'); - expect(noFraction(2000.00312, 0)).to.equal('2,000'); - expect(noFraction(2000998.00312, 0)).to.equal('2,000,998'); - })); - }); - - }); -}); diff --git a/test/old/servicesSpec.js b/test/old/servicesSpec.js deleted file mode 100644 index 6377c5131..000000000 --- a/test/old/servicesSpec.js +++ /dev/null @@ -1,215 +0,0 @@ -// -// test/unit/services/servicesSpec.js -// -// -// -var sinon = require('sinon'); -var preconditions = require('preconditions').singleton(); - - -describe("Angular services", function() { - beforeEach(angular.mock.module('copayApp')); - beforeEach(angular.mock.module('copayApp.services')); - beforeEach(module(function($provide) { - $provide.value('request', { - 'get': function(_, cb) { - cb(null, null, [{ - name: 'USD Dollars', - code: 'USD', - rate: 2 - }]); - } - }); - })); - - - beforeEach(inject(function($rootScope) { - - var w = {}; - w.isComplete = sinon.stub().returns(true); - w.privateKey = {}; - w.settings = { - unitToSatoshi: 100, - unitDecimals: 2, - alternativeName: 'US Dollar', - alternativeIsoCode: 'USD', - }; - w.addressBook = { - 'juan': '1', - }; - w.balanceByAddr = [{ - 'address1': 1 - }]; - - w.totalCopayers = 2; - w.getMyCopayerNickname = sinon.stub().returns('nickname'); - w.getMyCopayerId = sinon.stub().returns('id'); - w.privateKey.toObj = sinon.stub().returns({ - wallet: 'mock' - }); - w.getSecret = sinon.stub().returns('secret'); - w.getName = sinon.stub().returns('fakeWallet'); - w.getId = sinon.stub().returns('id'); - w.exportEncrypted = sinon.stub().returns('1234567'); - w.getTransactionHistory = sinon.stub().yields({}); - w.getNetworkName = sinon.stub().returns('testnet'); - w.getAddressesInfo = sinon.stub().returns({}); - - w.createTx = sinon.stub().yields(null); - w.sendTx = sinon.stub().yields(null); - w.requiresMultipleSignatures = sinon.stub().returns(true); - w.getTxProposals = sinon.stub().returns([1, 2, 3]); - $rootScope.wallet = w; - })); - - - - - describe("Unit: balanceService", function() { - - it('should updateBalance in bits', inject(function(balanceService, $rootScope) { - var w = $rootScope.wallet; - - expect(balanceService.update).not.to.equal(null); - var Waddr = Object.keys($rootScope.wallet.balanceByAddr)[0]; - var a = {}; - a[Waddr] = 200; - w.getBalance = sinon.stub().yields(null, 100000001, a, 90000002, 5); - - - //retuns values in DEFAULT UNIT(bits) - balanceService.update(w, function() { - var b = w.balanceInfo; - expect(b.totalBalanceBTC).to.be.equal(1.00000001); - expect(b.availableBalanceBTC).to.be.equal(0.90000002); - expect(b.lockedBalanceBTC).to.be.equal(0.09999999); - - expect(b.totalBalance).to.be.equal('1,000,000.01'); - expect(b.availableBalance).to.be.equal('900,000.02'); - expect(b.lockedBalance).to.be.equal('99,999.99'); - - expect(b.balanceByAddr[Waddr]).to.equal(2); - expect(b.safeUnspentCount).to.equal(5); - expect(b.topAmount).to.equal(899800.02); - }, false); - })); - - }); - - describe("Unit: Notification Service", function() { - it('should contain a notification service', inject(function(notification) { - expect(notification).not.to.equal(null); - })); - }); - - describe("Unit: identityService Service", function() { - it('should contain a identityService service', inject(function(identityService) { - expect(identityService).not.to.equal(null); - })); - }); - - describe("Unit: pinService", function() { - it('should contain a pinService service', inject(function(pinService) { - expect(pinService).not.to.equal(null); - })); - it('should be able to check -> save -> get -> clear -> check', function(done) { - inject(function(pinService) { - pinService.save('123', 'user', 'pass', function(err) { - pinService.check(function(err, value) { - should.not.exist(err); - value.should.equal(true); - pinService.get('123', function(err, data) { - should.not.exist(err); - data.email.should.be.equal('user'); - data.password.should.be.equal('pass'); - pinService.clear(function(err) { - should.not.exist(err); - pinService.check(function(err, value) { - should.not.exist(err); - value.should.equal(false); - done(); - }); - }); - }); - }); - }) - }) - }); - }); - - describe("Unit: localstorageService", function() { - it('should contain a localstorageService service', inject(function(localstorageService) { - expect(localstorageService).not.to.equal(null); - })); - }); - - - describe("Unit: Backup Service", function() { - 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({}, 'test'); - expectation.once(); - })); - }); - - describe("Unit: isMobile Service", function() { - it('should contain a isMobile service', inject(function(isMobile) { - expect(isMobile).not.to.equal(null); - })); - it('should not detect mobile by default', inject(function(isMobile) { - isMobile.any().should.equal(false); - })); - it('should detect mobile if user agent is Android', inject(function(isMobile) { - navigator.__defineGetter__('userAgent', function() { - return 'Android 2.2.3'; - }); - isMobile.any().should.equal(true); - })); - }); - - describe("Unit: uriHandler service", function() { - it('should contain a uriHandler service', inject(function(uriHandler) { - should.exist(uriHandler); - })); - it('should register', inject(function(uriHandler) { - (function() { - uriHandler.register(); - }).should.not.throw(); - })); - }); - - describe('Unit: Rate Service', function() { - it('should be injected correctly', inject(function(rateService) { - should.exist(rateService); - })); - it('should be possible to ask if it is available', - inject(function(rateService) { - should.exist(rateService.isAvailable); - }) - ); - it('should be possible to ask for conversion from fiat', - function(done) { - inject(function(rateService) { - rateService.whenAvailable(function() { - (1e8).should.equal(rateService.fromFiat(2, 'USD')); - done(); - }); - }) - } - ); - it('should be possible to ask for conversion to fiat', - function(done) { - inject(function(rateService) { - rateService.whenAvailable(function() { - (2).should.equal(rateService.toFiat(1e8, 'USD')); - done(); - }); - }) - } - ); - }); -}); diff --git a/test/old/sidebar.test.js b/test/old/sidebar.test.js deleted file mode 100644 index d3a197e69..000000000 --- a/test/old/sidebar.test.js +++ /dev/null @@ -1,11 +0,0 @@ -// 'use strict'; -// -// describe('sidebarController', function(){ -// var scope, controller; -// -// beforeEach(angular.mock.module('copayApp.controllers')); -// -// it('dummy test', function(){ -// should.exist(true); -// }); -// }); diff --git a/test/profiles.js b/test/profiles.js deleted file mode 100644 index 09b80184b..000000000 --- a/test/profiles.js +++ /dev/null @@ -1,65 +0,0 @@ -var incomplete2of2Wallet = { - "network": "livenet", - "xPrivKey": "xprv9s21ZrQH143K27bhzfejhNcitEAJgLKCfdLxwhr1FLu43FLqLwscAxXgmkucpF4k8eGmepSctkiQDbcR98Qd1bzSeDuR9jeyQAQEanPT2A4", - "xPubKey": "xpub6CkPnrzSUp9qzBVM3hpo4oS2JKC6GJq6brE1yW59QrnhDpvkFLakpxUGRGXH62fiXb5S2VbnD4h2DLoCMfSkwfonbNgNYTJw9Ko5SqWEqCR", - "requestPrivKey": "0cb89231b31dfaae9034ba794b9c48597eb573429f7b4b1f95e1945b22166bd5", - "requestPubKey": "022941a5ecb8c7224f812ad6b03bd1c9bb77861080b21703eabe18ef9a72b48e72", - "copayerId": "3d4eb9b439eee1b2b73cf792eda52e420f4665109c7234a50cf3cdbf296ea8fb", - "publicKeyRing": [{ - "xPubKey": "xpub6CkPnrzSUp9qzBVM3hpo4oS2JKC6GJq6brE1yW59QrnhDpvkFLakpxUGRGXH62fiXb5S2VbnD4h2DLoCMfSkwfonbNgNYTJw9Ko5SqWEqCR", - "requestPubKey": "022941a5ecb8c7224f812ad6b03bd1c9bb77861080b21703eabe18ef9a72b48e72" - }], - "walletId": "7bd8d22f-d132-43e1-b259-d5b430752553", - "walletName": "A test wallet", - "m": 2, - "n": 2, - "walletPrivKey": "Kz4CFSTgLzoYfMkt97BTBotUbZYXjMts6Ej9HbVfCf5oLmun1BXy", - "personalEncryptingKey": "1fgFP/uoLhVxJiMXOWQznA==", - "sharedEncryptingKey": "FZIY4+p4TfBAKRclKtrROw==", - "copayerName": "me", - "mnemonic": "dizzy cycle skirt decrease exotic fork sure mixture hair vapor copper hero", - "entropySource": "79e60ad83e04ee40967147fd6ac58f986c7dcf6c82b125fb4e8c30ff9f9584ee", - "mnemonicHasPassphrase": false, - "derivationStrategy": "BIP44", - "account": 0, - "addressType": "P2SH" -}; -var testnet1of1Wallet = { - "network": "testnet", - "xPrivKey": "tprv8ZgxMBicQKsPdK35ubrjCCpPCaBZA7QyKtxNNDWvYyjDAhtxV1HVNLzqwntAJ5QH1RTksRSfbuHLUYvMdGFmy9vHCb4yDRAR2zKqmX8mVa8", - "xPubKey": "tpubDDN7B6QnxsbomkZfPFRj6CVtC7LVh6ufoTpvzHfutjiHbu4hmiEGYDzxo5mgfqkQkBuwZPFkTYLNmQeLg7eFvdb4SFH1LW35sQD6xfymmRP", - "requestPrivKey": "aa39d4d780ad7ec36e26cbd0c0250bce85dfdd8aa7f2222ec7c86d6d62f242d7", - "requestPubKey": "038bb7cc1238280e893dd6949bfce770a319892b3c9045112ec7810191d4157ced", - "copayerId": "5c474b568bde8cd39efe069cd6aff2a80ab1cb18d3b9ae81f8225286f94856bc", - "publicKeyRing": [{ - "xPubKey": "tpubDDN7B6QnxsbomkZfPFRj6CVtC7LVh6ufoTpvzHfutjiHbu4hmiEGYDzxo5mgfqkQkBuwZPFkTYLNmQeLg7eFvdb4SFH1LW35sQD6xfymmRP", - "requestPubKey": "038bb7cc1238280e893dd6949bfce770a319892b3c9045112ec7810191d4157ced" - }], - "walletId": "66d3afc9-7d76-4b25-850e-aa62fcc53a7d", - "walletName": "kk", - "m": 1, - "n": 1, - "walletPrivKey": "1d6eb8e5a9f8944e97c2f13423c137ce912fac00f7eb5b3ffe6e3c161ea98bf7", - "personalEncryptingKey": "A2dQiAwpFY2xwIhE26ClFQ==", - "sharedEncryptingKey": "z0BtAIFclGQMH6eHqK9e3w==", - "copayerName": "me", - "mnemonic": "cheese where alarm job conduct donkey license pave congress pepper fence current", - "entropySource": "5c84e65837c0fbd11db935953dbacb60f5c33f40ecfe95e0feded1f62a5ee15d", - "mnemonicHasPassphrase": false, - "derivationStrategy": "BIP44", - "account": 0, - "addressType": "P2PKH" -}; - -var PROFILE = { - incomplete2of2: { - credentials: [incomplete2of2Wallet], - createdOn: 1463519749, - disclaimerAccepted: true, - }, - testnet1of1: { - credentials: [testnet1of1Wallet], - createdOn: 1463519749, - disclaimerAccepted: true, - }, -}; diff --git a/test/walletService.test.js b/test/walletService.test.js deleted file mode 100644 index 9dd11f549..000000000 --- a/test/walletService.test.js +++ /dev/null @@ -1,24 +0,0 @@ -describe('walletService', function() { - - var walletService; - - - // Adds walletService's module dependencies - beforeEach(function() { - module('ngLodash'); - module('gettext'); - module('angularMoment'); - module('bwcModule'); - module('copayApp.services'); - }); - - - beforeEach(inject(function(_walletService_) { - walletService = _walletService_; - })); - - it('should be defined', function() { - should.exist(walletService); - }); - -});