Skip to content
This repository has been archived by the owner on Apr 18, 2021. It is now read-only.

Commit

Permalink
chore: update yarn.lock, make test properly, remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JhChoy committed Feb 25, 2019
1 parent 3edc2ad commit 030388b
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 32 deletions.
7 changes: 7 additions & 0 deletions packages/vvisp-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,12 @@
},
"devDependencies": {
"openzeppelin-solidity": "2.0.0"
},
"nyc": {
"exclude": [
"test/dummy",
"*-config.js",
"**.test.js"
]
}
}
1 change: 0 additions & 1 deletion packages/vvisp-utils/src/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ Config.load = options => {
const config = new Config();

const fileConfig = require(file);
// TODO: file 읽지 않고 load/store 할 수 있도록
config.merge(fileConfig);
config.merge(options);

Expand Down
16 changes: 9 additions & 7 deletions packages/vvisp-utils/test/Config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ describe('# Config test', function() {
});

describe('#gasLimit', function() {
const TEST_NETWORK = 'coverage';
it('should not set directly', function() {
expect(() => {
config.gasLimit = 8000000;
Expand All @@ -366,25 +367,26 @@ describe('# Config test', function() {
});

it('should return right gasLimit', function() {
config.network = DEVELOPMENT;
config.network = TEST_NETWORK;
expect(config.gasLimit).to.equal(
sampleConfig.networks[DEVELOPMENT].gasLimit
sampleConfig.networks[TEST_NETWORK].gasLimit
);
});

it('should allow to receive gas also instead of gasLimit', function() {
const tmpConfig = _.cloneDeep(sampleConfig);
delete tmpConfig.networks[DEVELOPMENT].gasLimit;
delete tmpConfig.networks[TEST_NETWORK].gasLimit;
const sampleGas = 123123;
tmpConfig.networks[DEVELOPMENT].gas = sampleGas;
tmpConfig.networks[TEST_NETWORK].gas = sampleGas;

config.networks = tmpConfig.networks;
config.network = DEVELOPMENT;
config.network = TEST_NETWORK;
expect(config.gasLimit).to.equal(sampleGas);
});
});

describe('#gasPrice', function() {
const TEST_NETWORK = 'coverage';
it('should not set directly', function() {
expect(() => {
config.gasPrice = 10000000000;
Expand All @@ -396,9 +398,9 @@ describe('# Config test', function() {
});

it('should return right gas', function() {
config.network = DEVELOPMENT;
config.network = TEST_NETWORK;
expect(config.gasPrice).to.equal(
sampleConfig.networks[DEVELOPMENT].gasPrice
sampleConfig.networks[TEST_NETWORK].gasPrice
);
});
});
Expand Down
13 changes: 7 additions & 6 deletions packages/vvisp-utils/test/dummy/sample.vvisp-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ module.exports = {
development: {
host: 'localhost',
port: 8545,
network_id: '*', // eslint-disable-line camelcase
gasLimit: 123123,
gasPrice: 10000000000
network_id: '*' // eslint-disable-line camelcase
},
coverage: {
host: 'localhost',
port: 8545,
network_id: '*' // eslint-disable-line camelcase
network_id: '*', // eslint-disable-line camelcase
gasLimit: 123123,
gasPrice: 10000000000
}
},
compilers: {
solc: {
version: '0.4.25', // Fetch exact version from solc-bin (default: truffle's version)
version: '0.4.25', // Fetch exact version from solc-bin
settings: {
// See the solidity docs for advice about optimization and evmVersion
optimizer: {
Expand All @@ -27,7 +27,8 @@ module.exports = {
}
},
from: {
mnemonic: 'hello',
mnemonic:
'piano garage flag neglect spare title drill basic strong aware enforce fury',
index: 0
}
};
4 changes: 3 additions & 1 deletion packages/vvisp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@
"nyc": {
"exclude": [
"contractApis",
"test/dummy"
"test/dummy",
"*-config.js",
"**.test.js"
]
}
}
9 changes: 8 additions & 1 deletion packages/vvisp/scripts/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const fs = require('fs');
const path = require('path');
const chalk = require('chalk');
const stringArgv = require('string-argv');
const _ = require('lodash');
const { parseLogs } = require('@haechi-labs/vvisp-utils');

if (!String.prototype.format) {
Expand Down Expand Up @@ -34,6 +35,8 @@ const defaultStateFile = 'state.vvisp.json';
*/

module.exports = async function(scriptPath, options) {
options = require('./utils/injectConfig')(options);

let apis = setApi(scriptPath);
if (fs.existsSync(defaultStateFile)) {
apis = setApiAddress(apis, defaultStateFile);
Expand Down Expand Up @@ -360,7 +363,11 @@ function setApi(scriptPath) {
}

// set script api
const apis = require(path.join(scriptPath, 'back') + '/index.js');
// omit configuration functions
const apis = _.omit(require(path.join(scriptPath, 'back') + '/index.js')(), [
'config',
'setWeb3'
]);

// set abi
for (const key of Object.keys(apis)) {
Expand Down
13 changes: 7 additions & 6 deletions packages/vvisp/test/dummy/sample.vvisp-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ module.exports = {
development: {
host: 'localhost',
port: 8545,
network_id: '*', // eslint-disable-line camelcase
gasLimit: 123123,
gasPrice: 10000000000
network_id: '*' // eslint-disable-line camelcase
},
coverage: {
host: 'localhost',
port: 8545,
network_id: '*' // eslint-disable-line camelcase
network_id: '*', // eslint-disable-line camelcase
gasLimit: 123123,
gasPrice: 10000000000
}
},
compilers: {
solc: {
version: '0.4.25', // Fetch exact version from solc-bin (default: truffle's version)
version: '0.4.25', // Fetch exact version from solc-bin
settings: {
// See the solidity docs for advice about optimization and evmVersion
optimizer: {
Expand All @@ -27,7 +27,8 @@ module.exports = {
}
},
from: {
mnemonic: 'hello',
mnemonic:
'piano garage flag neglect spare title drill basic strong aware enforce fury',
index: 0
}
};
5 changes: 0 additions & 5 deletions packages/vvisp/test/scripts/console.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ const consoleTest = rewire('../../scripts/console.js');
describe('# console script test', async function() {
this.timeout(50000);

before('set ganache env', function() {
process.env.MNEMONIC =
'piano garage flag neglect spare title drill basic strong aware enforce fury';
});

describe('parseArgs', function() {
const parseArgs = consoleTest.__get__('parseArgs');

Expand Down
18 changes: 13 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3467,11 +3467,6 @@ dot-prop@^4.2.0:
dependencies:
is-obj "^1.0.0"

dotenv@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-5.0.1.tgz#a5317459bd3d79ab88cff6e44057a6a3fbb1fcef"
integrity sha512-4As8uPrjfwb7VXC+WnLCbXK7y+Ueb2B3zgNCePYfhxS1PYeaO1YTeplffTEcbfLhvFNGLAz90VvJs9yomG7bow==

drbg.js@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/drbg.js/-/drbg.js-1.0.1.tgz#3e36b6c42b37043823cdbc332d58f31e2445480b"
Expand Down Expand Up @@ -9911,6 +9906,19 @@ trim@0.0.1:
resolved "https://registry.yarnpkg.com/trim/-/trim-0.0.1.tgz#5858547f6b290757ee95cccc666fb50084c460dd"
integrity sha1-WFhUf2spB1fulczMZm+1AITEYN0=

truffle-error@^0.0.4:
version "0.0.4"
resolved "https://registry.yarnpkg.com/truffle-error/-/truffle-error-0.0.4.tgz#c3ff027570c26ae1f20db78637902497857f898f"
integrity sha512-hER0TNR4alBIhUp7SNrZRRiZtM/MBx+xBdM9qXP0tC3YASFmhNAxPuOyB8JDHFRNbDx12K7nvaqmyYGsI5c8BQ==

truffle-provider@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/truffle-provider/-/truffle-provider-0.1.4.tgz#0f445c40734a63077ddada50a6cbeff1eae57fb7"
integrity sha512-BE/3yhtarBqv5/o43UpwZ1ym2lQuF37cCpTBcHhb814T9iv5qXr8AsuwRhJSm/9x+Nu4wOvdd8TWzZeltjVdZQ==
dependencies:
truffle-error "^0.0.4"
web3 "1.0.0-beta.37"

tslib@^1.9.0:
version "1.9.3"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
Expand Down

0 comments on commit 030388b

Please sign in to comment.