Code coverage for Solidity smart-contracts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
/* eslint-env node, mocha */
|
|
|
|
/* global artifacts, contract, assert */
|
|
|
|
|
|
|
|
const Simple = artifacts.require('./Simple.sol');
|
|
|
|
|
|
|
|
contract('Simple', accounts => {
|
|
|
|
// Crash truffle if the account loaded in the options string isn't found here.
|
|
|
|
it('should load with expected account', () => {
|
|
|
|
if (accounts[0] !== '0xa4860cedd5143bd63f347cab453bf91425f8404f') {
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Generate some coverage so the script doesn't exit(1) because there are no events
|
|
|
|
it('should set x to 5', () => {
|
|
|
|
let simple;
|
|
|
|
return Simple.deployed().then(instance => {
|
|
|
|
simple = instance;
|
|
|
|
return simple.test(5);
|
|
|
|
})
|
|
|
|
.then(() => simple.getX.call())
|
|
|
|
.then(val => assert.equal(val.toNumber(), 5));
|
|
|
|
});
|
|
|
|
});
|