Skip to content

Instantly share code, notes, and snippets.

@dangerousfood
Created April 27, 2018 20:48
Show Gist options
  • Save dangerousfood/547212bb7376de85526a3a508fab4cdb to your computer and use it in GitHub Desktop.
Save dangerousfood/547212bb7376de85526a3a508fab4cdb to your computer and use it in GitHub Desktop.
const SimpleStorage = artifacts.require("SimpleStorage")
contract('SimpleStorage', (accounts) => {
const [bob, alice] = accounts
it("should verify bob and alice's favorite numbers default to 0", async () => {
const ssContract = await SimpleStorage.deployed()
const bobNum = await ssContract.favoriteNumbers.call(bob)
assert.equal(bobNum, 0,
"bob's default value was non-zero")
const aliceNum = await ssContract.favoriteNumbers.call(alice)
assert.equal(aliceNum, 0,
"alice's default value was non-zero")
})
it("should set bob's favorite number to 33", async () => {
const ssContract = await SimpleStorage.deployed()
ssContract.setFavorite(33, {from: bob})
const newBobNum = await ssContract.favoriteNumbers.call(bob)
assert.equal(newBobNum, 30,
"bob's new value was not 33")
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment