|
1 | 1 |
|
2 | 2 | $(document).ready(function() { |
3 | 3 |
|
4 | | - async.waterfall([ |
5 | | - function test1(callback) { |
6 | | - AnotherStorage.simpleStorageAddress().then(function(simpleStorageAddress) { |
7 | | - $("#tests").append("<br>test 1: " + (simpleStorageAddress === SimpleStorage.address)); |
8 | | - callback(); |
9 | | - }); |
10 | | - }, |
11 | | - function test2(callback) { |
12 | | - SimpleStorage.storedData().then(function(result) { |
13 | | - $("#tests").append("<br>test 2 (true first time): " + (result.toNumber() === 100)); |
14 | | - $("#tests").append("<br>test 2 (true after): " + (result.toNumber() === 150)); |
15 | | - callback(); |
16 | | - }); |
17 | | - }, |
18 | | - function test3(callback) { |
19 | | - SimpleStorage.set(150).then(function() { |
20 | | - SimpleStorage.get().then(function(result) { |
21 | | - $("#tests").append("<br>test 3: " + (result.toNumber() === 150)); |
| 4 | + document.getElementById("runTests").onclick = function() { |
| 5 | + async.waterfall([ |
| 6 | + function test1(callback) { |
| 7 | + AnotherStorage.methods.simpleStorageAddress().call().then(function(simpleStorageAddress) { |
| 8 | + $("#tests").append("<br>test 1: " + (simpleStorageAddress === SimpleStorage._address)); |
22 | 9 | callback(); |
23 | 10 | }); |
24 | | - }); |
25 | | - }, |
26 | | - function test4(callback) { |
27 | | - $("#tests").append("<br>test 4: " + (Token.address === "undefined")); |
28 | | - $("#tests").append("<br>test 4: " + (MyToken.address !== undefined)); |
29 | | - $("#tests").append("<br>test 4: " + (MyToken2.address !== undefined)); |
30 | | - callback(); |
31 | | - }, |
32 | | - function test5(callback) { |
33 | | - MyToken._supply().then(function(result) { |
34 | | - $("#tests").append("<br>test 5: " + (result.toNumber() === 1000)); |
| 11 | + }, |
| 12 | + function test2(callback) { |
| 13 | + SimpleStorage.methods.storedData().call().then(function(result) { |
| 14 | + $("#tests").append("<br>test 2 (true first time): " + (result === "100")); |
| 15 | + $("#tests").append("<br>test 2 (true after): " + (result === "150")); |
| 16 | + callback(); |
| 17 | + }); |
| 18 | + }, |
| 19 | + function test3(callback) { |
| 20 | + SimpleStorage.methods.set(150).send({from: web3.eth.defaultAccount}).then(function() { |
| 21 | + SimpleStorage.methods.get().call().then(function(result) { |
| 22 | + $("#tests").append("<br>test 3: " + (result === "150")); |
| 23 | + callback(); |
| 24 | + }); |
| 25 | + }); |
| 26 | + }, |
| 27 | + function test4(callback) { |
| 28 | + $("#tests").append("<br>test 4: " + (Token._address === null)); |
| 29 | + $("#tests").append("<br>test 4: " + (MyToken._address !== undefined)); |
| 30 | + $("#tests").append("<br>test 4: " + (MyToken2._address !== undefined)); |
35 | 31 | callback(); |
36 | | - }); |
37 | | - }, |
38 | | - function test6(callback) { |
39 | | - MyToken2._supply().then(function(result) { |
40 | | - $("#tests").append("<br>test 6: " + (result.toNumber() === 2000)); |
| 32 | + }, |
| 33 | + function test5(callback) { |
| 34 | + MyToken.methods._supply().call().then(function(result) { |
| 35 | + $("#tests").append("<br>test 5: " + (result === "1000")); |
| 36 | + callback(); |
| 37 | + }); |
| 38 | + }, |
| 39 | + function test6(callback) { |
| 40 | + MyToken2.methods._supply().call().then(function(result) { |
| 41 | + $("#tests").append("<br>test 6: " + (result === "2000")); |
| 42 | + callback(); |
| 43 | + }); |
| 44 | + }, |
| 45 | + function test7(callback) { |
| 46 | + $("#tests").append("<br>test 7: " + (AlreadyDeployedToken._address === "0xeCE374063fE5Cc7EFbACA0a498477CaDA94E5AD6")); |
41 | 47 | callback(); |
42 | | - }); |
43 | | - }, |
44 | | - function test7(callback) { |
45 | | - $("#tests").append("<br>test 7: " + (AlreadyDeployedToken.address === "0x123")); |
46 | | - callback(); |
47 | | - } |
48 | | - ], function (err, result) { |
| 48 | + } |
| 49 | + ], function (err, result) { |
49 | 50 | $("#tests").append("<br>done"); |
50 | | - }); |
| 51 | + }); |
| 52 | + |
| 53 | + }; |
51 | 54 |
|
52 | 55 | }); |
53 | 56 |
|
0 commit comments