Skip to content

Commit

Permalink
Reorganize test files
Browse files Browse the repository at this point in the history
  • Loading branch information
petejkim committed May 15, 2020
1 parent 6b53b46 commit 4c42934
Show file tree
Hide file tree
Showing 16 changed files with 1,105 additions and 101 deletions.
5 changes: 1 addition & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ module.exports = {
"plugin:prettier/recommended",
],
rules: {
camelcase: [
"error",
{ properties: "never", allow: ["run_tests", "test_suite_name"] },
],
camelcase: "error",
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"prettier/prettier": "warn",
"no-var": "error",
Expand Down
8 changes: 4 additions & 4 deletions test/v1/Pausable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ const {
deployerAccount,
arbitraryAccount,
pauserAccount,
} = require("./TokenTestUtils");
} = require("./helpers/tokenTest");

const Pausable = artifacts.require("Pausable");

contract("PausableTests", (_accounts) => {
contract("Pausable", (_accounts) => {
let pausable;

beforeEach(async () => {
pausable = await Pausable.new();
await pausable.updatePauser(pauserAccount);
pausable = await Pausable.new({ from: deployerAccount });
await pausable.updatePauser(pauserAccount, { from: deployerAccount });
});

it("constructor owner", async () => {
Expand Down
14 changes: 5 additions & 9 deletions test/v1/ABITests.test.js → test/v1/abiHacking.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { Transaction } = require("ethereumjs-tx");
const wrapTests = require("./helpers/wrapTests");
const {
expectRevert,
checkVariables,
Expand All @@ -9,23 +10,23 @@ const {
arbitraryAccountPrivateKey,
tokenOwnerPrivateKey,
pauserAccountPrivateKey,
} = require("./TokenTestUtils");
} = require("./helpers/tokenTest");
const {
makeRawTransaction,
sendRawTransaction,
functionSignature,
encodeAddress,
encodeUint,
msgData,
} = require("./ABIUtils");
} = require("./helpers/abi");

// Encodes methodName, 32 byte string of 0, and address.
function mockStringAddressEncode(methodName, address) {
const version = encodeUint(32) + encodeUint(0); // encode 32 byte string of 0's
return functionSignature(methodName) + version + encodeAddress(address);
}

async function run_tests(newToken, _accounts) {
function runTests(newToken, _accounts) {
let proxy, token;

beforeEach(async () => {
Expand Down Expand Up @@ -280,9 +281,4 @@ async function run_tests(newToken, _accounts) {
});
}

const testWrapper = require("./TestWrapper");
testWrapper.execute("FiatToken_ABIHackingTests", run_tests);

module.exports = {
run_tests,
};
wrapTests("FiatToken ABI hacking", runTests);
12 changes: 4 additions & 8 deletions test/v1/EventsTests.js → test/v1/events.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const wrapTests = require("./helpers/wrapTests");
const {
FiatTokenV1,
minterAccount,
Expand Down Expand Up @@ -27,11 +28,11 @@ const {
UpgradedFiatTokenNewFields,
checkPauseEvent,
checkTransferEvents,
} = require("./TokenTestUtils");
} = require("./helpers/tokenTest");

const amount = 100;

async function run_tests(_newToken, _accounts) {
function runTests(_newToken, _accounts) {
let proxy, token;

beforeEach(async () => {
Expand Down Expand Up @@ -197,9 +198,4 @@ async function run_tests(_newToken, _accounts) {
});
}

const testWrapper = require("./TestWrapper");
testWrapper.execute("FiatToken_EventTests", run_tests);

module.exports = {
run_tests,
};
wrapTests("FiatToken events", runTests);
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const BN = require("bn.js");
const wrapTests = require("./helpers/wrapTests");
const {
checkVariables,
arbitraryAccount,
Expand All @@ -11,11 +12,11 @@ const {
initializeTokenWithProxy,
UpgradedFiatToken,
upgradeTo,
} = require("./TokenTestUtils");
} = require("./helpers/tokenTest");

const amount = 100;

async function run_tests(newToken, _accounts) {
function runTests(newToken, _accounts) {
let proxy, token;

beforeEach(async () => {
Expand Down Expand Up @@ -495,9 +496,4 @@ async function run_tests(newToken, _accounts) {
});
}

const testWrapper = require("./TestWrapper");
testWrapper.execute("FiatToken_ExtendedPositiveTests", run_tests);

module.exports = {
run_tests,
};
wrapTests("FiatToken extended positive", runTests);
File renamed without changes.
Loading

0 comments on commit 4c42934

Please sign in to comment.