Commit 0b63eb68 authored by Iuri Matias's avatar Iuri Matias

refactor; separate runTestFile from runTest

parent 811067ec
......@@ -5,7 +5,11 @@ let Compiler = require('./src/compiler.js');
let Deployer = require('./src/deployer.js');
let TestRunner = require('./src/testRunner.js');
var runTest = function(filename, web3) {
var runTest = function(contractName, contractObj, cb) {
TestRunner.runTest(contractName, contractObj, cb);
}
var runTestFile = function(filename, web3) {
let result, accounts, contracts;
async.waterfall([
......@@ -19,13 +23,13 @@ var runTest = function(filename, web3) {
Deployer.deployAll(result, web3, next);
},
function runTests(contracts, next) {
let test = contracts.MyTest;
TestRunner.runTest("SimpleStorage", test, next);
runTest("SimpleStorage", contracts.MyTest, next);
}
], function() {
});
}
module.exports = {
runTest: runTest
runTestFile: runTestFile
};
......@@ -5,7 +5,7 @@ const RemixTests = require('./index.js');
commander.action(function (filename) {
let web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));
RemixTests.runTest(filename, web3);
RemixTests.runTestFile(filename, web3);
});
if (!process.argv.slice(2).length) {
......
let fs = require('fs');
//let compiler = require('solc');
var async = require('async');
let remixLib = require('remix-lib');
......@@ -8,15 +7,6 @@ let RemixCompiler = require('remix-solidity').Compiler;
// TODO: replace this with remix's own compiler code
function compileAll(cb) {
//const input = {
// "simple_storage.sol": fs.readFileSync("examples/simple_storage.sol").toString(),
// "tests.sol": fs.readFileSync("examples/tests.sol").toString(),
// "simple_storage_test.sol": fs.readFileSync("examples/simple_storage_test.sol").toString()
//};
//const optimize = 1;
//result = compiler.compileStandardWrapper({sources: input}, optimize);
//cb(null, result.contracts);
console.log("compile all");
let compiler;
......@@ -43,8 +33,6 @@ function compileAll(cb) {
compiler.compile(sources, "examples/");
}
], function(err, result) {
console.dir("==== result ====");
console.dir(result);
cb(null, result.contracts);
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment