mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-17 09:46:37 +00:00
update tests in the test_app
This commit is contained in:
parent
8c1b9b56cf
commit
be7d4b0d4d
@ -1,53 +1,56 @@
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
async.waterfall([
|
document.getElementById("runTests").onclick = function() {
|
||||||
function test1(callback) {
|
async.waterfall([
|
||||||
AnotherStorage.simpleStorageAddress().then(function(simpleStorageAddress) {
|
function test1(callback) {
|
||||||
$("#tests").append("<br>test 1: " + (simpleStorageAddress === SimpleStorage.address));
|
AnotherStorage.methods.simpleStorageAddress().call().then(function(simpleStorageAddress) {
|
||||||
callback();
|
$("#tests").append("<br>test 1: " + (simpleStorageAddress === SimpleStorage._address));
|
||||||
});
|
|
||||||
},
|
|
||||||
function test2(callback) {
|
|
||||||
SimpleStorage.storedData().then(function(result) {
|
|
||||||
$("#tests").append("<br>test 2 (true first time): " + (result.toNumber() === 100));
|
|
||||||
$("#tests").append("<br>test 2 (true after): " + (result.toNumber() === 150));
|
|
||||||
callback();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
function test3(callback) {
|
|
||||||
SimpleStorage.set(150).then(function() {
|
|
||||||
SimpleStorage.get().then(function(result) {
|
|
||||||
$("#tests").append("<br>test 3: " + (result.toNumber() === 150));
|
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
});
|
},
|
||||||
},
|
function test2(callback) {
|
||||||
function test4(callback) {
|
SimpleStorage.methods.storedData().call().then(function(result) {
|
||||||
$("#tests").append("<br>test 4: " + (Token.address === "undefined"));
|
$("#tests").append("<br>test 2 (true first time): " + (result === "100"));
|
||||||
$("#tests").append("<br>test 4: " + (MyToken.address !== undefined));
|
$("#tests").append("<br>test 2 (true after): " + (result === "150"));
|
||||||
$("#tests").append("<br>test 4: " + (MyToken2.address !== undefined));
|
callback();
|
||||||
callback();
|
});
|
||||||
},
|
},
|
||||||
function test5(callback) {
|
function test3(callback) {
|
||||||
MyToken._supply().then(function(result) {
|
SimpleStorage.methods.set(150).send({from: web3.eth.defaultAccount}).then(function() {
|
||||||
$("#tests").append("<br>test 5: " + (result.toNumber() === 1000));
|
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));
|
||||||
callback();
|
callback();
|
||||||
});
|
},
|
||||||
},
|
function test5(callback) {
|
||||||
function test6(callback) {
|
MyToken.methods._supply().call().then(function(result) {
|
||||||
MyToken2._supply().then(function(result) {
|
$("#tests").append("<br>test 5: " + (result === "1000"));
|
||||||
$("#tests").append("<br>test 6: " + (result.toNumber() === 2000));
|
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"));
|
||||||
callback();
|
callback();
|
||||||
});
|
}
|
||||||
},
|
], function (err, result) {
|
||||||
function test7(callback) {
|
|
||||||
$("#tests").append("<br>test 7: " + (AlreadyDeployedToken.address === "0x123"));
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
], function (err, result) {
|
|
||||||
$("#tests").append("<br>done");
|
$("#tests").append("<br>done");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body class="container">
|
<body class="container">
|
||||||
|
|
||||||
|
<button id="runTests">Run Tests</button>
|
||||||
<div id="tests"></div>
|
<div id="tests"></div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user