REF: tests

This commit is contained in:
Overtorment 2019-06-08 13:57:44 +01:00
parent 8bea87e145
commit 988461818e
9 changed files with 19 additions and 19 deletions

View File

@ -29,7 +29,7 @@
"ios": "react-native run-ios",
"postinstall": "./node_modules/.bin/rn-nodeify --install buffer,events,process,stream,util,inherits,fs,path --hack; npm run releasenotes2json; npm run podinstall",
"test": "npm run unit && npm run jest && npm run lint",
"jest": "node node_modules/jest/bin/jest.js",
"jest": "node node_modules/jest/bin/jest.js tests/integration/*",
"lint": "./node_modules/.bin/eslint *.js screen/**/*.js screen/ class/ models/ loc/ --fix",
"unit": "./node_modules/.bin/mocha tests/**/*.js"
},

View File

@ -1,11 +1,11 @@
/* global describe, it, expect, jest, jasmine */
import React from 'react';
import { LegacyWallet, SegwitP2SHWallet, AppStorage } from './class';
import { LegacyWallet, SegwitP2SHWallet, AppStorage } from '../../class';
import TestRenderer from 'react-test-renderer';
import Settings from './screen/settings/settings';
import Selftest from './screen/selftest';
import { BlueHeader } from './BlueComponents';
import { FiatUnit } from './models/fiatUnit';
import Settings from '../../screen/settings/settings';
import Selftest from '../../screen/selftest';
import { BlueHeader } from '../../BlueComponents';
import { FiatUnit } from '../../models/fiatUnit';
import AsyncStorage from '@react-native-community/async-storage';
global.crypto = require('crypto'); // shall be used by tests under nodejs CLI, but not in RN environment
let assert = require('assert');
@ -303,7 +303,7 @@ it('Wallet can fetch TXs', async () => {
describe('currency', () => {
it('fetches exchange rate and saves to AsyncStorage', async () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 15000;
let currency = require('./currency');
let currency = require('../../currency');
await currency.startUpdater();
let cur = await AsyncStorage.getItem(AppStorage.EXCHANGE_RATES);
cur = JSON.parse(cur);

View File

@ -2,7 +2,7 @@
let assert = require('assert');
it('bip38 decodes', async () => {
const bip38 = require('./bip38');
const bip38 = require('../../bip38');
const wif = require('wif');
let encryptedKey = '6PRVWUbkzq2VVjRuv58jpwVjTeN46MeNmzUHqUjQptBJUHGcBakduhrUNc';
@ -25,7 +25,7 @@ it('bip38 decodes slow', async () => {
return;
}
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
const bip38 = require('bip38');
const bip38 = require('../../bip38');
const wif = require('wif');
let encryptedKey = '6PnU5voARjBBykwSddwCdcn6Eu9EcsK24Gs5zWxbJbPZYW7eiYQP8XgKbN';

View File

@ -1,6 +1,6 @@
/* global it, describe, afterAll, beforeAll, jasmine */
global.net = require('net');
let BlueElectrum = require('./BlueElectrum');
let BlueElectrum = require('../../BlueElectrum');
let assert = require('assert');
let bitcoin = require('bitcoinjs-lib');
jasmine.DEFAULT_TIMEOUT_INTERVAL = 150 * 1000;

View File

@ -1,9 +1,9 @@
/* global it, describe, jasmine, afterAll, beforeAll */
import { HDSegwitBech32Wallet } from './class';
import { HDSegwitBech32Wallet } from '../../class';
global.crypto = require('crypto'); // shall be used by tests under nodejs CLI, but not in RN environment
let assert = require('assert');
global.net = require('net'); // needed by Electrum client. For RN it is proviced in shim.js
let BlueElectrum = require('./BlueElectrum'); // so it connects ASAP
let BlueElectrum = require('../../BlueElectrum'); // so it connects ASAP
afterAll(async () => {
// after all tests we close socket so the test suite can actually terminate

View File

@ -1,10 +1,10 @@
/* global it, jasmine, afterAll, beforeAll */
import { SegwitP2SHWallet, SegwitBech32Wallet, HDSegwitP2SHWallet, HDLegacyBreadwalletWallet, HDLegacyP2PKHWallet } from './class';
import { SegwitP2SHWallet, SegwitBech32Wallet, HDSegwitP2SHWallet, HDLegacyBreadwalletWallet, HDLegacyP2PKHWallet } from '../../class';
global.crypto = require('crypto'); // shall be used by tests under nodejs CLI, but not in RN environment
let assert = require('assert');
let bitcoin = require('bitcoinjs-lib');
global.net = require('net'); // needed by Electrum client. For RN it is proviced in shim.js
let BlueElectrum = require('./BlueElectrum'); // so it connects ASAP
let BlueElectrum = require('../../BlueElectrum'); // so it connects ASAP
jasmine.DEFAULT_TIMEOUT_INTERVAL = 300 * 1000;
afterAll(() => {

View File

@ -1,6 +1,6 @@
/* global it, describe, jasmine */
import Frisbee from 'frisbee';
import { LightningCustodianWallet } from './class';
import { LightningCustodianWallet } from '../../class';
let assert = require('assert');
describe('LightningCustodianWallet', () => {

View File

@ -3,7 +3,7 @@ let assert = require('assert');
describe('Localization', () => {
it('has all keys in all locales', async () => {
let en = require('./loc/en');
let en = require('../../loc/en');
let noErrors = true;
for (let key1 of Object.keys(en)) {
for (let key2 of Object.keys(en[key1])) {
@ -11,7 +11,7 @@ describe('Localization', () => {
for (let lang of ['es', 'pt_BR', 'pt_PT', 'ru', 'ua']) {
// iteratin all locales except EN
let locale = require('./loc/' + lang);
let locale = require('../../loc/' + lang);
if (typeof locale[key1] === 'undefined') {
console.error('Missing: ' + lang + '.' + key1);

View File

@ -1,8 +1,8 @@
/* global it, describe, jasmine, afterAll, beforeAll */
import { WatchOnlyWallet } from './class';
import { WatchOnlyWallet } from '../../class';
let assert = require('assert');
global.net = require('net'); // needed by Electrum client. For RN it is proviced in shim.js
let BlueElectrum = require('./BlueElectrum'); // so it connects ASAP
let BlueElectrum = require('../../BlueElectrum'); // so it connects ASAP
afterAll(async () => {
// after all tests we close socket so the test suite can actually terminate