2023-03-14 05:48:42 +00:00
|
|
|
const Storage = artifacts.require('Storage')
|
2021-07-12 09:22:20 +00:00
|
|
|
|
|
|
|
contract('Test Storage Contract', async function (accounts) {
|
2023-03-14 05:48:42 +00:00
|
|
|
let storageInstance
|
2021-07-12 09:22:20 +00:00
|
|
|
|
|
|
|
before(function () {
|
2023-03-14 05:48:42 +00:00
|
|
|
console.log(`Using Accounts (${accounts.length}): \n${accounts.join('\n')}`)
|
|
|
|
console.log('==========================\n')
|
2021-07-12 09:22:20 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
it('should deploy Stroage contract', async function () {
|
2023-03-14 05:48:42 +00:00
|
|
|
storageInstance = await Storage.new()
|
|
|
|
console.log(`Deployed Storage at: ${storageInstance.address}`)
|
|
|
|
expect(storageInstance.address).not.to.be.undefined
|
|
|
|
})
|
2021-07-12 09:22:20 +00:00
|
|
|
|
|
|
|
it('should succesfully stored a value', async function () {
|
2023-03-14 05:48:42 +00:00
|
|
|
const tx = await storageInstance.store(888)
|
|
|
|
console.log(`Stored value 888 by tx: ${tx.tx}`)
|
|
|
|
expect(tx.tx).not.to.be.undefined
|
|
|
|
})
|
2021-07-12 09:22:20 +00:00
|
|
|
|
|
|
|
it('should succesfully retrieve a value', async function () {
|
2023-03-14 05:48:42 +00:00
|
|
|
const value = await storageInstance.retrieve()
|
|
|
|
expect(value.toString()).to.equal('888')
|
|
|
|
})
|
|
|
|
})
|