laconicd-deprecated/tests/solidity/suites/storage/test/0_test_contracts.test.js
Yijia Su fa77bae105
tests: refactor solidity test cases (#249)
* Refactor

* add script to run all tests

* Spawn ethermintd in node script

* Update README

* kill process when test finished

* add new test case

* add yarn.lock inside tests to be tracked
2021-07-12 05:22:20 -04:00

30 lines
910 B
JavaScript

const Storage = artifacts.require('Storage');
contract('Test Storage Contract', async function (accounts) {
let storageInstance;
before(function () {
console.log(`Using Accounts (${accounts.length}): \n${accounts.join('\n')}`);
console.log('==========================\n');
})
it('should deploy Stroage contract', async function () {
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 () {
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 () {
const value = await storageInstance.retrieve();
expect(value.toString()).to.equal('888');
});
})