/
Tested.test.js
28 lines (22 loc) · 987 Bytes
/
Tested.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const { BN, constants, expectEvent, expectFailure } = require('openzeppelin-test-helpers');
const Tested = artifacts.require('Tested');
contract('Tested', function (accounts) {
it('detects events during construction', async function () {
await expectEvent.inConstruction(await Tested.new(3), 'Constructed', { value: new BN(3) });
});
context('with deployed instance', function () {
beforeEach(async function () {
this.contract = await Tested.new(0);
})
it('detect reverts', async function () {
await expectFailure.revert(this.contract.reverts());
});
it('accepts calls with non-zero address', async function () {
const { logs } = await this.contract.nonZeroAddress(accounts[0]);
expectEvent.inLogs(logs, 'Address', { account: accounts[0] });
});
it('reverts with calls with non-zero address', async function () {
await expectFailure.revert(this.contract.nonZeroAddress(constants.ZERO_ADDRESS));
});
});
});