Skip to content

Instantly share code, notes, and snippets.

@mseijas
Created May 23, 2018 19:33
Show Gist options
  • Save mseijas/2f86f5a804a239a63281e96a989c1b55 to your computer and use it in GitHub Desktop.
Save mseijas/2f86f5a804a239a63281e96a989c1b55 to your computer and use it in GitHub Desktop.
const SocialNetworkProxy = artifacts.require('SocialNetworkProxy')
const SocialNetworkV1 = artifacts.require('SocialNetworkV1')
contract('SocialNetworkProxy', async () => {
let proxy, socialNetworkProxy, socialNetworkV1
before(async () => {
proxy = await SocialNetworkProxy.deployed()
socialNetworkV1 = await SocialNetworkV1.deployed()
})
it('should have the SocialNetworkV1 address as its implementation', async () => {
const implementation = await proxy.implementation()
expect(implementation).to.equal(socialNetworkV1.address)
})
context('when delegating to the SocialNetworkV1 contract', async () => {
before(async () => {
socialNetworkProxy = SocialNetworkV1.at(proxy.address)
})
it('should return a name', async () => {
const name = await socialNetworkProxy.name()
expect(name).to.equal('TanookiChats')
})
it('should return an imageUrl', async () => {
const imageUrl = await socialNetworkProxy.imageUrl()
expect(imageUrl).to.equal('http://tanookilabs.com/images/tanooki-small@2x-0500fc1e.png')
})
it('sould allow us to update the imageUrl', async () => {
await socialNetworkProxy.setImageUrl('http://tanookilabs.com/images/exploding-beaker@2x-30aa1907.png')
const imageUrl = await socialNetworkProxy.imageUrl()
expect(imageUrl).to.equal('http://tanookilabs.com/images/exploding-beaker@2x-30aa1907.png')
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment