mirror of https://github.com/hyperledger/besu
An enterprise-grade Java-based, Apache 2.0 licensed Ethereum client https://wiki.hyperledger.org/display/besu
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.
32 lines
937 B
32 lines
937 B
/* global artifacts contract describe assert it */
|
|
|
|
const TestAdoption = artifacts.require('Adoption.sol');
|
|
var proxy;
|
|
contract('Adoption 1', () => {
|
|
describe('Function: adopt pet 1', () => {
|
|
it('Should successfully adopt pet within range', async () => {
|
|
proxy = await TestAdoption.new();
|
|
await proxy.adopt(1);
|
|
|
|
assert(true, 'expected adoption of pet within range to succeed');
|
|
});
|
|
|
|
it('Should catch an error and then return', async () => {
|
|
try {
|
|
await proxy.adopt(22);
|
|
} catch (err) {
|
|
assert(true, err.toString().includes('revert'), 'expected revert in message');
|
|
|
|
return;
|
|
}
|
|
|
|
assert(false, 'did not catch expected error from petID out of range');
|
|
});
|
|
|
|
it('Should successfully adopt pet within range 2', async () => {
|
|
await proxy.adopt(2);
|
|
|
|
assert(true, 'expected adoption of pet within range to succeed');
|
|
});
|
|
});
|
|
});
|
|
|