Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ganache to 2.5.5 (fixes bug related to fixture) #103

Merged
merged 1 commit into from Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@resolver-engine/imports-fs": "^0.3.2",
"@resolver-engine/imports": "^0.3.2",
"ethers": "^4.0.0",
"ganache-core": "2.4.0",
"ganache-core": "2.5.5",
"solc": "^0.5.1"
},
"resolutions": {
Expand Down
28 changes: 27 additions & 1 deletion test/fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,34 @@
import {expect} from 'chai';
import {loadFixture, createFixtureLoader} from '../lib/waffle';
import {loadFixture, createFixtureLoader, deployContract} from '../lib/waffle';
import {utils, Wallet, providers} from 'ethers';
import Check from './example/build/Check.json';

const fixtureDeployCheck = async (porvider: providers.Provider, [someWallet]: Wallet[]) => {
const contract = await deployContract(someWallet, Check);
return {contract};
};

describe('Integration: Fixtures', () => {
let contract: any;

beforeEach(async () => {
({contract} = await loadFixture(fixtureDeployCheck));
});

it('works for contract', async () => {
await contract.change();
expect(await contract.x()).to.equal(2);
({contract} = await loadFixture(fixtureDeployCheck));
expect(await contract.x()).to.equal(1);
});

it('works for contract', async () => {
await contract.change();
expect(await contract.x()).to.equal(2);
({contract} = await loadFixture(fixtureDeployCheck));
expect(await contract.x()).to.equal(1);
});

it('are called once per fixture', async () => {
let countA = 0;
let countB = 0;
Expand Down
14 changes: 14 additions & 0 deletions test/projects/example/Check.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pragma solidity ^0.5.1;

contract Check {

uint public x;

constructor () public {
x = 1;
}

function change() public {
x += 1;
}
}