Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Use promise to avoid race condition #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions test/metacoin.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ contract('MetaCoin', function(accounts) {
it("should call a function that depends on a linked library", function() {
var meta;
var metaCoinBalance;
var metaCoinEthBalance;

return MetaCoin.deployed().then(function(instance) {
meta = instance;
Expand All @@ -20,9 +19,9 @@ contract('MetaCoin', function(accounts) {
metaCoinBalance = outCoinBalance.toNumber();
return meta.getBalanceInEth.call(accounts[0]);
}).then(function(outCoinBalanceEth) {
metaCoinEthBalance = outCoinBalanceEth.toNumber();
}).then(function() {
assert.equal(metaCoinEthBalance, 2 * metaCoinBalance, "Library function returned unexpeced function, linkage may be broken");
return outCoinBalanceEth.toNumber();
}).then(function(metaCoinEthBalance) {
assert.equal(metaCoinEthBalance, 2 * metaCoinBalance, "Library function returned unexpected function, linkage may be broken");
});
});

Expand Down