Created
December 27, 2020 21:12
-
-
Save reime005/820aa591567ab7948c4449b82af65e61 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
it('should allow only the owner to change the contract name', async function() { | |
const instance = await NameStorageExample.deployed(); | |
const CONTRACT_NAME_TO_CHANGE = "ChangedNameStorageExample"; | |
// check if someone other than the owner is eligible to change the contract name | |
// function will revert if not the owner tries so | |
// note: account[0] is the owner of the contract | |
await expectRevert( | |
instance.changeContractName(CONTRACT_NAME_TO_CHANGE, | |
fromAccount(accounts, 1) | |
) | |
) | |
// let the owner change the name | |
const tx1 = await instance.changeContractName(CONTRACT_NAME_TO_CHANGE); | |
const contractNameAfter = await instance.contractName(); | |
await assert.equal(contractNameAfter, | |
CONTRACT_NAME_TO_CHANGE, "not equal"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment