Last active
February 14, 2019 21:52
-
-
Save NoahMarconi/cc58948ce86efbf325b34119df8ac9ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MetaCoin = artifacts.require("MetaCoin"); | |
const SafeMath = artifacts.require("SafeMath"); | |
const mode = process.env.MODE; | |
let metaCoinInstance; | |
let safeMathInstance; | |
contract("MetaCoin", accounts => { | |
beforeEach(async function() { | |
metaCoinInstance = await MetaCoin.new(); | |
safeMathInstance = await SafeMath.new(); | |
}); | |
after("write coverage/profiler output", async () => { | |
if (mode === "profile") { | |
await global.profilerSubprovider.writeProfilerOutputAsync(); | |
} else if (mode === "coverage") { | |
await global.coverageSubprovider.writeCoverageAsync(); | |
} | |
}); | |
it("should send coin correctly", async () => { | |
const accountOne = accounts[0]; | |
const accountTwo = accounts[1]; | |
const amount = 2; // The balance of the owner (account[0]) is 1 (assigned in the constructor), so the transaction sending 2 will fail. | |
if (mode === "profile") { | |
global.profilerSubprovider.start(); | |
} | |
await metaCoinInstance.sendCoin( | |
safeMathInstance.address, | |
accountTwo, | |
amount, | |
{ from: accountOne } | |
); | |
if (mode === "profile") { | |
global.profilerSubprovider.stop(); | |
} | |
}); | |
it("should send coin correctly", async () => { | |
const accountOne = accounts[0]; | |
const accountTwo = accounts[1]; | |
const amount = 2; // The balance of the owner (account[0]) is 1 (assigned in the constructor), so the transaction sending 2 will fail. | |
if (mode === "profile") { | |
global.profilerSubprovider.start(); | |
} | |
await metaCoinInstance.sendCoin( | |
safeMathInstance.address, | |
accountTwo, | |
amount, | |
{ from: accountOne } | |
); | |
if (mode === "profile") { | |
global.profilerSubprovider.stop(); | |
} | |
}); | |
it("should send coin correctly", async () => { | |
const accountOne = accounts[0]; | |
const accountTwo = accounts[1]; | |
const amount = 2; // The balance of the owner (account[0]) is 1 (assigned in the constructor), so the transaction sending 2 will fail. | |
if (mode === "profile") { | |
global.profilerSubprovider.start(); | |
} | |
await metaCoinInstance.sendCoin( | |
safeMathInstance.address, | |
accountTwo, | |
amount, | |
{ from: accountOne } | |
); | |
if (mode === "profile") { | |
global.profilerSubprovider.stop(); | |
} | |
}); | |
it("should send coin correctly", async () => { | |
const accountOne = accounts[0]; | |
const accountTwo = accounts[1]; | |
const amount = 2; // The balance of the owner (account[0]) is 1 (assigned in the constructor), so the transaction sending 2 will fail. | |
if (mode === "profile") { | |
global.profilerSubprovider.start(); | |
} | |
await metaCoinInstance.sendCoin( | |
safeMathInstance.address, | |
accountTwo, | |
amount, | |
{ from: accountOne } | |
); | |
if (mode === "profile") { | |
global.profilerSubprovider.stop(); | |
} | |
}); | |
it("should send coin correctly", async () => { | |
const accountOne = accounts[0]; | |
const accountTwo = accounts[1]; | |
const amount = 2; // The balance of the owner (account[0]) is 1 (assigned in the constructor), so the transaction sending 2 will fail. | |
if (mode === "profile") { | |
global.profilerSubprovider.start(); | |
} | |
await metaCoinInstance.sendCoin( | |
safeMathInstance.address, | |
accountTwo, | |
amount, | |
{ from: accountOne } | |
); | |
if (mode === "profile") { | |
global.profilerSubprovider.stop(); | |
} | |
}); | |
it("should send coin correctly", async () => { | |
const accountOne = accounts[0]; | |
const accountTwo = accounts[1]; | |
const amount = 2; // The balance of the owner (account[0]) is 1 (assigned in the constructor), so the transaction sending 2 will fail. | |
if (mode === "profile") { | |
global.profilerSubprovider.start(); | |
} | |
await metaCoinInstance.sendCoin( | |
safeMathInstance.address, | |
accountTwo, | |
amount, | |
{ from: accountOne } | |
); | |
if (mode === "profile") { | |
global.profilerSubprovider.stop(); | |
} | |
}); | |
it("should send coin correctly", async () => { | |
const accountOne = accounts[0]; | |
const accountTwo = accounts[1]; | |
const amount = 2; // The balance of the owner (account[0]) is 1 (assigned in the constructor), so the transaction sending 2 will fail. | |
if (mode === "profile") { | |
global.profilerSubprovider.start(); | |
} | |
await metaCoinInstance.sendCoin( | |
safeMathInstance.address, | |
accountTwo, | |
amount, | |
{ from: accountOne } | |
); | |
if (mode === "profile") { | |
global.profilerSubprovider.stop(); | |
} | |
}); | |
it("should send coin correctly", async () => { | |
const accountOne = accounts[0]; | |
const accountTwo = accounts[1]; | |
const amount = 2; // The balance of the owner (account[0]) is 1 (assigned in the constructor), so the transaction sending 2 will fail. | |
if (mode === "profile") { | |
global.profilerSubprovider.start(); | |
} | |
await metaCoinInstance.sendCoin( | |
safeMathInstance.address, | |
accountTwo, | |
amount, | |
{ from: accountOne } | |
); | |
if (mode === "profile") { | |
global.profilerSubprovider.stop(); | |
} | |
}); | |
it("should send coin correctly", async () => { | |
const accountOne = accounts[0]; | |
const accountTwo = accounts[1]; | |
const amount = 2; // The balance of the owner (account[0]) is 1 (assigned in the constructor), so the transaction sending 2 will fail. | |
if (mode === "profile") { | |
global.profilerSubprovider.start(); | |
} | |
await metaCoinInstance.sendCoin( | |
safeMathInstance.address, | |
accountTwo, | |
amount, | |
{ from: accountOne } | |
); | |
if (mode === "profile") { | |
global.profilerSubprovider.stop(); | |
} | |
}); | |
it("should send coin correctly", async () => { | |
const accountOne = accounts[0]; | |
const accountTwo = accounts[1]; | |
const amount = 2; // The balance of the owner (account[0]) is 1 (assigned in the constructor), so the transaction sending 2 will fail. | |
if (mode === "profile") { | |
global.profilerSubprovider.start(); | |
} | |
await metaCoinInstance.sendCoin( | |
safeMathInstance.address, | |
accountTwo, | |
amount, | |
{ from: accountOne } | |
); | |
if (mode === "profile") { | |
global.profilerSubprovider.stop(); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment