From be7d4b0d4d0cbe332f29c41c3ea996c3cde83e16 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sat, 21 Oct 2017 09:33:32 -0400 Subject: [PATCH] update tests in the test_app --- test_app/app/js/test.js | 87 +++++++++++++++++++++-------------------- test_app/app/test.html | 1 + 2 files changed, 46 insertions(+), 42 deletions(-) diff --git a/test_app/app/js/test.js b/test_app/app/js/test.js index ad51fa25..a4ba623c 100644 --- a/test_app/app/js/test.js +++ b/test_app/app/js/test.js @@ -1,53 +1,56 @@ $(document).ready(function() { - async.waterfall([ - function test1(callback) { - AnotherStorage.simpleStorageAddress().then(function(simpleStorageAddress) { - $("#tests").append("
test 1: " + (simpleStorageAddress === SimpleStorage.address)); - callback(); - }); - }, - function test2(callback) { - SimpleStorage.storedData().then(function(result) { - $("#tests").append("
test 2 (true first time): " + (result.toNumber() === 100)); - $("#tests").append("
test 2 (true after): " + (result.toNumber() === 150)); - callback(); - }); - }, - function test3(callback) { - SimpleStorage.set(150).then(function() { - SimpleStorage.get().then(function(result) { - $("#tests").append("
test 3: " + (result.toNumber() === 150)); + document.getElementById("runTests").onclick = function() { + async.waterfall([ + function test1(callback) { + AnotherStorage.methods.simpleStorageAddress().call().then(function(simpleStorageAddress) { + $("#tests").append("
test 1: " + (simpleStorageAddress === SimpleStorage._address)); callback(); }); - }); - }, - function test4(callback) { - $("#tests").append("
test 4: " + (Token.address === "undefined")); - $("#tests").append("
test 4: " + (MyToken.address !== undefined)); - $("#tests").append("
test 4: " + (MyToken2.address !== undefined)); - callback(); - }, - function test5(callback) { - MyToken._supply().then(function(result) { - $("#tests").append("
test 5: " + (result.toNumber() === 1000)); + }, + function test2(callback) { + SimpleStorage.methods.storedData().call().then(function(result) { + $("#tests").append("
test 2 (true first time): " + (result === "100")); + $("#tests").append("
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("
test 3: " + (result === "150")); + callback(); + }); + }); + }, + function test4(callback) { + $("#tests").append("
test 4: " + (Token._address === null)); + $("#tests").append("
test 4: " + (MyToken._address !== undefined)); + $("#tests").append("
test 4: " + (MyToken2._address !== undefined)); callback(); - }); - }, - function test6(callback) { - MyToken2._supply().then(function(result) { - $("#tests").append("
test 6: " + (result.toNumber() === 2000)); + }, + function test5(callback) { + MyToken.methods._supply().call().then(function(result) { + $("#tests").append("
test 5: " + (result === "1000")); + callback(); + }); + }, + function test6(callback) { + MyToken2.methods._supply().call().then(function(result) { + $("#tests").append("
test 6: " + (result === "2000")); + callback(); + }); + }, + function test7(callback) { + $("#tests").append("
test 7: " + (AlreadyDeployedToken._address === "0xeCE374063fE5Cc7EFbACA0a498477CaDA94E5AD6")); callback(); - }); - }, - function test7(callback) { - $("#tests").append("
test 7: " + (AlreadyDeployedToken.address === "0x123")); - callback(); - } - ], function (err, result) { + } + ], function (err, result) { $("#tests").append("
done"); - }); + }); + + }; }); diff --git a/test_app/app/test.html b/test_app/app/test.html index 2fcceb29..ee41604a 100644 --- a/test_app/app/test.html +++ b/test_app/app/test.html @@ -6,6 +6,7 @@ +