Reorganize the repo structure (#2503)

Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
This commit is contained in:
Hadrien Croubois
2021-02-22 17:44:16 +01:00
committed by GitHub
parent c3178ff942
commit 24a0bc23cf
174 changed files with 724 additions and 372 deletions

View File

@ -1,79 +0,0 @@
const { expectRevert } = require('@openzeppelin/test-helpers');
const { assert } = require('chai');
const InitializableMock = artifacts.require('InitializableMock');
const SampleChild = artifacts.require('SampleChild');
contract('Initializable', function (accounts) {
describe('basic testing without inheritance', function () {
beforeEach('deploying', async function () {
this.contract = await InitializableMock.new();
});
context('before initialize', function () {
it('initializer has not run', async function () {
assert.isFalse(await this.contract.initializerRan());
});
});
context('after initialize', function () {
beforeEach('initializing', async function () {
await this.contract.initialize();
});
it('initializer has run', async function () {
assert.isTrue(await this.contract.initializerRan());
});
it('initializer does not run again', async function () {
await expectRevert(this.contract.initialize(), 'Initializable: contract is already initialized');
});
});
context('after nested initialize', function () {
beforeEach('initializing', async function () {
await this.contract.initializeNested();
});
it('initializer has run', async function () {
assert.isTrue(await this.contract.initializerRan());
});
});
});
describe('complex testing with inheritance', function () {
const mother = 12;
const gramps = '56';
const father = 34;
const child = 78;
beforeEach('deploying', async function () {
this.contract = await SampleChild.new();
});
beforeEach('initializing', async function () {
await this.contract.initialize(mother, gramps, father, child);
});
it('initializes human', async function () {
assert.equal(await this.contract.isHuman(), true);
});
it('initializes mother', async function () {
assert.equal(await this.contract.mother(), mother);
});
it('initializes gramps', async function () {
assert.equal(await this.contract.gramps(), gramps);
});
it('initializes father', async function () {
assert.equal(await this.contract.father(), father);
});
it('initializes child', async function () {
assert.equal(await this.contract.child(), child);
});
});
});

View File

@ -1,4 +1,4 @@
const shouldBehaveLikeUpgradeableProxy = require('./UpgradeableProxy.behaviour');
const shouldBehaveLikeUpgradeableProxy = require('../UpgradeableProxy.behaviour');
const shouldBehaveLikeTransparentUpgradeableProxy = require('./TransparentUpgradeableProxy.behaviour');
const TransparentUpgradeableProxy = artifacts.require('TransparentUpgradeableProxy');