embark-area-51/test_apps/test_app/app/js/test.js

57 lines
2.0 KiB
JavaScript
Raw Normal View History

2017-02-10 02:05:45 +00:00
$(document).ready(function() {
2017-10-21 13:33:32 +00:00
document.getElementById("runTests").onclick = function() {
async.waterfall([
function test1(callback) {
AnotherStorage.methods.simpleStorageAddress().call().then(function(simpleStorageAddress) {
$("#tests").append("<br>test 1: " + (simpleStorageAddress === SimpleStorage._address));
2017-02-10 02:05:45 +00:00
callback();
});
2017-10-21 13:33:32 +00:00
},
function test2(callback) {
SimpleStorage.methods.storedData().call().then(function(result) {
$("#tests").append("<br>test 2 (true first time): " + (result === "100"));
$("#tests").append("<br>test 2 (true after): " + (result === "150"));
callback();
});
},
function test3(callback) {
SimpleStorage.methods.set(150).send({from: web3.eth.defaultAccount}).then(function() {
SimpleStorage.methods.get().call().then(function(result) {
$("#tests").append("<br>test 3: " + (result === "150"));
callback();
});
});
},
function test4(callback) {
$("#tests").append("<br>test 4: " + (Token._address === null));
$("#tests").append("<br>test 4: " + (MyToken._address !== undefined));
$("#tests").append("<br>test 4: " + (MyToken2._address !== undefined));
2017-02-10 02:05:45 +00:00
callback();
2017-10-21 13:33:32 +00:00
},
function test5(callback) {
MyToken.methods._supply().call().then(function(result) {
$("#tests").append("<br>test 5: " + (result === "1000"));
callback();
});
},
function test6(callback) {
MyToken2.methods._supply().call().then(function(result) {
$("#tests").append("<br>test 6: " + (result === "2000"));
callback();
});
},
function test7(callback) {
$("#tests").append("<br>test 7: " + (AlreadyDeployedToken._address === "0xeCE374063fE5Cc7EFbACA0a498477CaDA94E5AD6"));
2017-02-10 02:05:45 +00:00
callback();
2017-10-21 13:33:32 +00:00
}
], function (err, result) {
2017-02-10 02:05:45 +00:00
$("#tests").append("<br>done");
2017-10-21 13:33:32 +00:00
});
};
2017-02-10 02:05:45 +00:00
});