laconicd-deprecated/tests/solidity/suites/storage/test/0_test_contracts.test.js

28 lines
893 B
JavaScript
Raw Normal View History

2023-03-14 05:48:42 +00:00
const Storage = artifacts.require('Storage')
contract('Test Storage Contract', async function (accounts) {
2023-03-14 05:48:42 +00:00
let storageInstance
before(function () {
2023-03-14 05:48:42 +00:00
console.log(`Using Accounts (${accounts.length}): \n${accounts.join('\n')}`)
console.log('==========================\n')
})
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
})
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
})
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')
})
})