Skip to content

Commit

Permalink
Merge pull request #61 from TomAFrench/buidlerEVM
Browse files Browse the repository at this point in the history
switch to buidlerEVM for testing
  • Loading branch information
TomAFrench authored May 28, 2020
2 parents 8bf3e27 + 29956c0 commit 10cdf31
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 56 deletions.
3 changes: 0 additions & 3 deletions packages/contracts/.waffle.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"deploy": "buidler run scripts/deploy.js",
"export": "buidler export",
"has:changed": "bash ../monorepo-scripts/ci/hasChanged.sh contracts",
"test": "waffle .waffle.json && mocha test/runTests.js --timeout 5000",
"test": "buidler test test/runTests.js",
"lint:js": "eslint --config .eslintrc.js ./scripts ./test"
},
"files": [
Expand Down
9 changes: 3 additions & 6 deletions packages/contracts/test/NoteStream/cancelStream.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
const { waffle } = require('@nomiclabs/buidler');
const { use, expect } = require('chai');
const {
solidity,
MockProvider,
createFixtureLoader,
} = require('ethereum-waffle');
const { solidity, createFixtureLoader } = require('ethereum-waffle');
const { bigNumberify, Interface } = require('ethers/utils');

const { devConstants, mochaContexts } = require('@notestream/dev-utils');
Expand All @@ -28,7 +25,7 @@ const {

use(solidity);

const provider = new MockProvider();
const { provider } = waffle;
const [sender, recipient, attacker] = provider.getWallets();
const loadFixture = createFixtureLoader(provider, [sender, recipient]);

Expand Down
5 changes: 3 additions & 2 deletions packages/contracts/test/NoteStream/constructor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { waffle } = require('@nomiclabs/buidler');
const { use, expect } = require('chai');
const { solidity, MockProvider, deployContract } = require('ethereum-waffle');
const { solidity, deployContract } = require('ethereum-waffle');

const { devConstants } = require('@notestream/dev-utils');
const NoteStream = require('../../build/NoteStream.json');
Expand All @@ -10,7 +11,7 @@ use(solidity);

// eslint-disable-next-line no-undef
describe('NoteStream - constructor', function () {
const provider = new MockProvider();
const { provider } = waffle;
const [deployer] = provider.getWallets();

it('reverts when the ACE contract is the zero address', async function () {
Expand Down
9 changes: 3 additions & 6 deletions packages/contracts/test/NoteStream/createStream.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
// const { devConstants } = require("@notestream/dev-utils");
const { waffle } = require('@nomiclabs/buidler');
const { use, expect } = require('chai');
const {
solidity,
MockProvider,
createFixtureLoader,
} = require('ethereum-waffle');
const { solidity, createFixtureLoader } = require('ethereum-waffle');
const { bigNumberify, Interface } = require('ethers/utils');

const { devConstants } = require('@notestream/dev-utils');
Expand All @@ -25,7 +22,7 @@ use(solidity);

// eslint-disable-next-line no-undef
describe('NoteStream - createStream', function () {
const provider = new MockProvider();
const { provider } = waffle;
const [sender, recipient] = provider.getWallets();
const loadFixture = createFixtureLoader(provider, [sender, recipient]);

Expand Down
9 changes: 3 additions & 6 deletions packages/contracts/test/NoteStream/getStream.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
// const { devConstants } = require("@notestream/dev-utils");
const { waffle } = require('@nomiclabs/buidler');
const { use, expect } = require('chai');
const {
solidity,
MockProvider,
createFixtureLoader,
} = require('ethereum-waffle');
const { solidity, createFixtureLoader } = require('ethereum-waffle');
const { bigNumberify } = require('ethers/utils');

const { noteStreamFixture } = require('../fixtures');
Expand All @@ -13,7 +10,7 @@ use(solidity);

// eslint-disable-next-line no-undef
describe('NoteStream - getStream', function () {
const provider = new MockProvider();
const { provider } = waffle;
const [sender, recipient] = provider.getWallets();
const loadFixture = createFixtureLoader(provider, [sender, recipient]);

Expand Down
3 changes: 2 additions & 1 deletion packages/contracts/test/NoteStream/withdrawFromStream.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { waffle } = require('@nomiclabs/buidler');
const { use, expect } = require('chai');
const {
solidity,
Expand Down Expand Up @@ -29,7 +30,7 @@ const {
use(solidity);

function runTests() {
const provider = new MockProvider();
const { provider } = waffle;
const [sender, recipient] = provider.getWallets();
const loadFixture = createFixtureLoader(provider, [sender, recipient]);

Expand Down
9 changes: 3 additions & 6 deletions packages/contracts/test/StreamUtilities/getRatio.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
const { waffle } = require('@nomiclabs/buidler');
const { use } = require('chai');
const {
solidity,
MockProvider,
createFixtureLoader,
} = require('ethereum-waffle');
const { solidity, createFixtureLoader } = require('ethereum-waffle');
const { StreamUtilitiesFixture } = require('../fixtures');

use(solidity);

describe('StreamUtilities - getRatio', function () {
const provider = new MockProvider();
const { provider } = waffle;
const [sender, recipient] = provider.getWallets();
const loadFixture = createFixtureLoader(provider, [sender, recipient]);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
const { waffle } = require('@nomiclabs/buidler');
const { use } = require('chai');
const {
solidity,
MockProvider,
createFixtureLoader,
} = require('ethereum-waffle');
const { solidity, createFixtureLoader } = require('ethereum-waffle');
const { StreamUtilitiesFixture } = require('../fixtures');

use(solidity);

describe('StreamUtilities - processCancellation', function () {
const provider = new MockProvider();
const { provider } = waffle;
const [sender, recipient] = provider.getWallets();
const loadFixture = createFixtureLoader(provider, [sender, recipient]);

Expand Down
9 changes: 3 additions & 6 deletions packages/contracts/test/StreamUtilities/processWithdrawal.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
const { waffle } = require('@nomiclabs/buidler');
const { use } = require('chai');
const {
solidity,
MockProvider,
createFixtureLoader,
} = require('ethereum-waffle');
const { solidity, createFixtureLoader } = require('ethereum-waffle');
const { StreamUtilitiesFixture } = require('../fixtures');

use(solidity);

describe('StreamUtilities - processWithdrawal', function () {
const provider = new MockProvider();
const { provider } = waffle;
const [sender, recipient] = provider.getWallets();
const loadFixture = createFixtureLoader(provider, [sender, recipient]);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
const { waffle } = require('@nomiclabs/buidler');
const { use } = require('chai');
const {
solidity,
MockProvider,
createFixtureLoader,
} = require('ethereum-waffle');
const { solidity, createFixtureLoader } = require('ethereum-waffle');
const { StreamUtilitiesFixture } = require('../fixtures');

use(solidity);

describe('StreamUtilities - validateJoinSplitProof', function () {
const provider = new MockProvider();
const { provider } = waffle;
const [sender, recipient] = provider.getWallets();
const loadFixture = createFixtureLoader(provider, [sender, recipient]);

Expand Down
9 changes: 3 additions & 6 deletions packages/contracts/test/StreamUtilities/validateRatioProof.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
const { waffle } = require('@nomiclabs/buidler');
const { use } = require('chai');
const {
solidity,
MockProvider,
createFixtureLoader,
} = require('ethereum-waffle');
const { solidity, createFixtureLoader } = require('ethereum-waffle');
const { StreamUtilitiesFixture } = require('../fixtures');

use(solidity);

describe('StreamUtilities - validateRatioProof', function () {
const provider = new MockProvider();
const { provider } = waffle;
const [sender, recipient] = provider.getWallets();
const loadFixture = createFixtureLoader(provider, [sender, recipient]);

Expand Down
4 changes: 3 additions & 1 deletion packages/dev-utils/src/mochaContexts.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ function contextForSpecificTime(
functions,
) {
const now = bigNumberify(moment().format('X'));
let snapshot;

describe(contextText, function () {
beforeEach(async function () {
snapshot = await traveler.takeSnapshot(provider);
await traveler.advanceBlockAndSetTime(
provider,
now.add(timeDuration.toString()).toNumber(),
Expand All @@ -26,7 +28,7 @@ function contextForSpecificTime(
functions();

afterEach(async function () {
await traveler.advanceBlockAndSetTime(provider, now.toNumber());
await traveler.revertToSnapshot(provider, snapshot);
});
});
}
Expand Down

1 comment on commit 10cdf31

@vercel
Copy link

@vercel vercel bot commented on 10cdf31 May 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.