Last active
July 13, 2018 17:47
-
-
Save adrianmcli/b57c12c65c201faf5b41bd525b4fe5fe 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 Counter = artifacts.require("Counter") | |
contract("Counter", (accounts) => { | |
it("should initialize with a count of 0", async () => { | |
const counter = await Counter.deployed() | |
const count = await counter.get.call() | |
const expected = 0 | |
assert.equal(count, expected, "count was not initialized with 0") | |
}) | |
it("should increment to a count of 1", async () => { | |
const counter = await Counter.deployed() | |
await counter.increment({ from: accounts[0] }) | |
const count = await counter.get.call() | |
const expected = 1 | |
assert.equal(count, expected, "count was not incremented to 1") | |
}) | |
it("should decrement back to a count of 0", async () => { | |
const counter = await Counter.deployed() | |
await counter.decrement({ from: accounts[0] }) | |
const count = await counter.get.call() | |
const expected = 0 | |
assert.equal(count, expected, "count was not decremented back to 0") | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment