embark/lib/test.js

25 lines
702 B
JavaScript
Raw Normal View History

2015-10-09 14:57:30 +00:00
var ethersim = require('ethersim');
var web3 = require('web3');
Test = function(contractFiles, blockchainFile, contractFile, _env) {
2015-10-12 14:50:52 +00:00
this.env = _env || 'development';
this.web3 = web3;
this.web3.setProvider(ethersim.web3Provider());
this.contractFiles = contractFiles;
2015-10-09 14:57:30 +00:00
2015-10-12 14:50:52 +00:00
Embark.init(this.web3);
Embark.blockchainConfig.loadConfigFile(blockchainFile);
Embark.contractsConfig.loadConfigFile(contractFile);
2015-10-09 14:57:30 +00:00
2015-10-12 14:50:52 +00:00
Embark.contractsConfig.init(this.contractFiles, this.env);
}
2015-10-09 14:57:30 +00:00
2015-10-12 14:50:52 +00:00
Test.prototype.deployAll = function(cb) {
Embark.deployContracts('development', this.contractFiles, "/tmp/abi.js", "chains.json", false, false, function(abi) {
2015-10-09 14:57:30 +00:00
eval(abi);
cb();
});
}
module.exports = Test;