request needed class
This commit is contained in:
parent
7695c1616f
commit
bda4267fa2
|
@ -1,4 +1,6 @@
|
||||||
SimpleStorage = require('embark-framework').Tests();
|
var Tests = require('embark-framework').Tests;
|
||||||
|
|
||||||
|
SimpleStorage = Tests.request("SimpleStorage");
|
||||||
|
|
||||||
SimpleStorage.set(100);
|
SimpleStorage.set(100);
|
||||||
|
|
||||||
|
|
13
lib/test.js
13
lib/test.js
|
@ -29,9 +29,9 @@ TestContractWrapper = (function() {
|
||||||
py_exec("example_abi")
|
py_exec("example_abi")
|
||||||
py_exec("example_binary = '" + example_binary + "'.decode('hex')")
|
py_exec("example_binary = '" + example_binary + "'.decode('hex')")
|
||||||
py_exec("example_binary")
|
py_exec("example_binary")
|
||||||
py_exec(className + "_contract = EvmContract(example_abi, example_binary)")
|
py_exec(this.className + "_contract = EvmContract(example_abi, example_binary)")
|
||||||
|
|
||||||
this.contractVariable = className + "_contract"
|
this.contractVariable = this.className + "_contract"
|
||||||
};
|
};
|
||||||
|
|
||||||
TestContractWrapper.prototype.execCmd = function(method, args) {
|
TestContractWrapper.prototype.execCmd = function(method, args) {
|
||||||
|
@ -58,15 +58,18 @@ TestContract = function(contract, className) {
|
||||||
return Obj;
|
return Obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleStorage = function() {
|
request = function(className) {
|
||||||
filename = './app/contracts/simple_storage.sol'
|
filename = './app/contracts/simple_storage.sol'
|
||||||
source = fs.readFileSync(filename).toString()
|
source = fs.readFileSync(filename).toString()
|
||||||
className = 'SimpleStorage'
|
|
||||||
|
|
||||||
compiled_contracts = web3.eth.compile.solidity(source)
|
compiled_contracts = web3.eth.compile.solidity(source)
|
||||||
contract = compiled_contracts[className]
|
contract = compiled_contracts[className]
|
||||||
return TestContract(contract, className)
|
return TestContract(contract, className)
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = SimpleStorage;
|
Test = {
|
||||||
|
request: request
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Test;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue