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:
committed by
Francisco Giordano
parent
ca6a5dc8a2
commit
5f92adc2e7
@ -1,3 +1,5 @@
|
||||
const { accounts, contract } = require('@openzeppelin/test-environment');
|
||||
|
||||
const { BN, constants, expectEvent, expectRevert } = require('@openzeppelin/test-helpers');
|
||||
const { expect } = require('chai');
|
||||
const { ZERO_ADDRESS } = constants;
|
||||
@ -8,9 +10,11 @@ const {
|
||||
shouldBehaveLikeERC20Approve,
|
||||
} = require('./ERC20.behavior');
|
||||
|
||||
const ERC20Mock = artifacts.require('ERC20Mock');
|
||||
const ERC20Mock = contract.fromArtifact('ERC20Mock');
|
||||
|
||||
describe('ERC20', function () {
|
||||
const [ initialHolder, recipient, anotherAccount ] = accounts;
|
||||
|
||||
contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) {
|
||||
const initialSupply = new BN(100);
|
||||
|
||||
beforeEach(async function () {
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
const { accounts, contract } = require('@openzeppelin/test-environment');
|
||||
|
||||
const { BN } = require('@openzeppelin/test-helpers');
|
||||
|
||||
const { shouldBehaveLikeERC20Burnable } = require('./behaviors/ERC20Burnable.behavior');
|
||||
const ERC20BurnableMock = artifacts.require('ERC20BurnableMock');
|
||||
const ERC20BurnableMock = contract.fromArtifact('ERC20BurnableMock');
|
||||
|
||||
describe('ERC20Burnable', function () {
|
||||
const [ owner, ...otherAccounts ] = accounts;
|
||||
|
||||
contract('ERC20Burnable', function ([_, owner, ...otherAccounts]) {
|
||||
const initialBalance = new BN(1000);
|
||||
|
||||
beforeEach(async function () {
|
||||
|
||||
@ -1,10 +1,14 @@
|
||||
const { accounts, contract } = require('@openzeppelin/test-environment');
|
||||
|
||||
const { BN, ether, expectRevert } = require('@openzeppelin/test-helpers');
|
||||
const { shouldBehaveLikeERC20Mintable } = require('./behaviors/ERC20Mintable.behavior');
|
||||
const { shouldBehaveLikeERC20Capped } = require('./behaviors/ERC20Capped.behavior');
|
||||
|
||||
const ERC20Capped = artifacts.require('ERC20Capped');
|
||||
const ERC20Capped = contract.fromArtifact('ERC20Capped');
|
||||
|
||||
describe('ERC20Capped', function () {
|
||||
const [ minter, ...otherAccounts ] = accounts;
|
||||
|
||||
contract('ERC20Capped', function ([_, minter, ...otherAccounts]) {
|
||||
const cap = ether('1000');
|
||||
|
||||
it('requires a non-zero cap', async function () {
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
const { contract } = require('@openzeppelin/test-environment');
|
||||
const { BN } = require('@openzeppelin/test-helpers');
|
||||
|
||||
const { expect } = require('chai');
|
||||
|
||||
const ERC20DetailedMock = artifacts.require('ERC20DetailedMock');
|
||||
const ERC20DetailedMock = contract.fromArtifact('ERC20DetailedMock');
|
||||
|
||||
contract('ERC20Detailed', function () {
|
||||
describe('ERC20Detailed', function () {
|
||||
const _name = 'My Detailed ERC20';
|
||||
const _symbol = 'MDT';
|
||||
const _decimals = new BN(18);
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
const { accounts, contract } = require('@openzeppelin/test-environment');
|
||||
|
||||
const { shouldBehaveLikeERC20Mintable } = require('./behaviors/ERC20Mintable.behavior');
|
||||
const ERC20MintableMock = artifacts.require('ERC20MintableMock');
|
||||
const ERC20MintableMock = contract.fromArtifact('ERC20MintableMock');
|
||||
const { shouldBehaveLikePublicRole } = require('../../behaviors/access/roles/PublicRole.behavior');
|
||||
|
||||
contract('ERC20Mintable', function ([_, minter, otherMinter, ...otherAccounts]) {
|
||||
describe('ERC20Mintable', function () {
|
||||
const [ minter, otherMinter, ...otherAccounts ] = accounts;
|
||||
|
||||
beforeEach(async function () {
|
||||
this.token = await ERC20MintableMock.new({ from: minter });
|
||||
});
|
||||
|
||||
@ -1,11 +1,15 @@
|
||||
const { accounts, contract } = require('@openzeppelin/test-environment');
|
||||
|
||||
const { BN, expectEvent, expectRevert } = require('@openzeppelin/test-helpers');
|
||||
|
||||
const { expect } = require('chai');
|
||||
|
||||
const ERC20PausableMock = artifacts.require('ERC20PausableMock');
|
||||
const ERC20PausableMock = contract.fromArtifact('ERC20PausableMock');
|
||||
const { shouldBehaveLikePublicRole } = require('../../behaviors/access/roles/PublicRole.behavior');
|
||||
|
||||
contract('ERC20Pausable', function ([_, pauser, otherPauser, recipient, anotherAccount, ...otherAccounts]) {
|
||||
describe('ERC20Pausable', function () {
|
||||
const [ pauser, otherPauser, recipient, anotherAccount, ...otherAccounts ] = accounts;
|
||||
|
||||
const initialSupply = new BN(100);
|
||||
|
||||
beforeEach(async function () {
|
||||
|
||||
@ -1,11 +1,15 @@
|
||||
const { accounts, contract } = require('@openzeppelin/test-environment');
|
||||
|
||||
const { expectRevert } = require('@openzeppelin/test-helpers');
|
||||
|
||||
const ERC20ReturnFalseMock = artifacts.require('ERC20ReturnFalseMock');
|
||||
const ERC20ReturnTrueMock = artifacts.require('ERC20ReturnTrueMock');
|
||||
const ERC20NoReturnMock = artifacts.require('ERC20NoReturnMock');
|
||||
const SafeERC20Wrapper = artifacts.require('SafeERC20Wrapper');
|
||||
const ERC20ReturnFalseMock = contract.fromArtifact('ERC20ReturnFalseMock');
|
||||
const ERC20ReturnTrueMock = contract.fromArtifact('ERC20ReturnTrueMock');
|
||||
const ERC20NoReturnMock = contract.fromArtifact('ERC20NoReturnMock');
|
||||
const SafeERC20Wrapper = contract.fromArtifact('SafeERC20Wrapper');
|
||||
|
||||
describe('SafeERC20', function () {
|
||||
const [ hasNoCode ] = accounts;
|
||||
|
||||
contract('SafeERC20', function ([_, hasNoCode]) {
|
||||
describe('with address that has no contract code', function () {
|
||||
beforeEach(async function () {
|
||||
this.wrapper = await SafeERC20Wrapper.new(hasNoCode);
|
||||
|
||||
@ -1,11 +1,15 @@
|
||||
const { accounts, contract } = require('@openzeppelin/test-environment');
|
||||
|
||||
const { BN, expectRevert, time } = require('@openzeppelin/test-helpers');
|
||||
|
||||
const { expect } = require('chai');
|
||||
|
||||
const ERC20Mintable = artifacts.require('ERC20Mintable');
|
||||
const TokenTimelock = artifacts.require('TokenTimelock');
|
||||
const ERC20Mintable = contract.fromArtifact('ERC20Mintable');
|
||||
const TokenTimelock = contract.fromArtifact('TokenTimelock');
|
||||
|
||||
describe('TokenTimelock', function () {
|
||||
const [ minter, beneficiary ] = accounts;
|
||||
|
||||
contract('TokenTimelock', function ([_, minter, beneficiary]) {
|
||||
const amount = new BN(100);
|
||||
|
||||
context('with token', function () {
|
||||
|
||||
Reference in New Issue
Block a user