mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-09 21:35:58 +00:00
a3b52676fc
* fix: fix tests hanging because the console is not started * fix(@embark/proxy): send back errors correctly to the client Code originally by @emizzle and fixed by me * feat(@embark/test-runner): add assert.reverts to test reverts * fix: make test app actually run its test and not hang * fix(@embark/proxy): fix listening to contract event in the proxy * feat(@embark/test-runner): add assertion for events being triggered * docs(@embark/site): add docs for the new assert functions * feat(@embark/test-runner): add increaseTime util function to globals * docs(@embark/site): add docs for increaseTime
35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
/*global contract, it, embark, assert, before, web3*/
|
|
const SimpleStorage = require('Embark/contracts/SimpleStorage');
|
|
const {Utils} = require('Embark/EmbarkJS');
|
|
|
|
contract("SimpleStorage Deploy", function () {
|
|
let simpleStorageInstance;
|
|
before(function(done) {
|
|
Utils.secureSend(web3, SimpleStorage.deploy({arguments: [150]}), {}, true, function(err, receipt) {
|
|
if(err) {
|
|
return done(err);
|
|
}
|
|
simpleStorageInstance = SimpleStorage;
|
|
simpleStorageInstance.options.address = receipt.contractAddress;
|
|
done();
|
|
});
|
|
});
|
|
|
|
it("should set constructor value", async function () {
|
|
let result = await simpleStorageInstance.methods.storedData().call();
|
|
assert.strictEqual(parseInt(result, 10), 150);
|
|
});
|
|
|
|
it("set storage value", function (done) {
|
|
Utils.secureSend(web3, simpleStorageInstance.methods.set(200), {}, false, async function(err) {
|
|
if (err) {
|
|
return done(err);
|
|
}
|
|
let result = await simpleStorageInstance.methods.get().call();
|
|
assert.strictEqual(parseInt(result, 10), 200);
|
|
done();
|
|
});
|
|
});
|
|
|
|
});
|