Migrate from truffle to test-environment (#2007)

* Sketch

* Migrate all tests to test-env

* Finish migration to test-env

* Add config

* Work on GSN tests

* Migrate to newer test-env version and loader syntax

* Add GSN setup

* Finish test-env migration

* Setup coverage using test-env

* Migrate to npm package

* Fix package.json

* Add compile step to CI

* Add comment on coverage setup

* Remove dependency on @truffle/contract

* Fix package-lock merge

* Fix linter errors

* Upgrade test-environment, depend locally on ganche-coverage

* Improve coverage script

* Improve sign.js API

* Move accounts destructuring to describe block

* Switch to prebuilt ethereumjs-vm package

* Upgrade test-enviroment version

* use workspace in circleci config

* remove unnecessary npx
This commit is contained in:
Nicolás Venturo
2019-11-28 15:46:42 -03:00
committed by Francisco Giordano
parent ca6a5dc8a2
commit 5f92adc2e7
87 changed files with 23947 additions and 890 deletions

View File

@ -11,8 +11,8 @@ function shouldBehaveLikeOwnable (owner, [other]) {
it('changes owner after transfer', async function () {
expect(await this.ownable.isOwner({ from: other })).to.equal(false);
const { logs } = await this.ownable.transferOwnership(other, { from: owner });
expectEvent.inLogs(logs, 'OwnershipTransferred');
const receipt = await this.ownable.transferOwnership(other, { from: owner });
expectEvent(receipt, 'OwnershipTransferred');
expect(await this.ownable.owner()).to.equal(other);
expect(await this.ownable.isOwner({ from: other })).to.equal(true);
@ -33,8 +33,8 @@ function shouldBehaveLikeOwnable (owner, [other]) {
});
it('loses owner after renouncement', async function () {
const { logs } = await this.ownable.renounceOwnership({ from: owner });
expectEvent.inLogs(logs, 'OwnershipTransferred');
const receipt = await this.ownable.renounceOwnership({ from: owner });
expectEvent(receipt, 'OwnershipTransferred');
expect(await this.ownable.owner()).to.equal(ZERO_ADDRESS);
});

View File

@ -1,9 +1,13 @@
const { accounts, contract } = require('@openzeppelin/test-environment');
require('@openzeppelin/test-helpers');
const { shouldBehaveLikeOwnable } = require('./Ownable.behavior');
const Ownable = artifacts.require('OwnableMock');
const Ownable = contract.fromArtifact('OwnableMock');
describe('Ownable', function () {
const [ owner, ...otherAccounts ] = accounts;
contract('Ownable', function ([_, owner, ...otherAccounts]) {
beforeEach(async function () {
this.ownable = await Ownable.new({ from: owner });
});

View File

@ -1,11 +1,15 @@
const { accounts, contract } = require('@openzeppelin/test-environment');
const { constants, expectEvent, expectRevert } = require('@openzeppelin/test-helpers');
const { ZERO_ADDRESS } = constants;
const { expect } = require('chai');
const SecondaryMock = artifacts.require('SecondaryMock');
const SecondaryMock = contract.fromArtifact('SecondaryMock');
describe('Secondary', function () {
const [ primary, newPrimary, other ] = accounts;
contract('Secondary', function ([_, primary, newPrimary, other]) {
beforeEach(async function () {
this.secondary = await SecondaryMock.new({ from: primary });
});