aboutsummaryrefslogtreecommitdiffstats
path: root/packages/deployer/test
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-04-10 19:44:15 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-04-12 18:50:38 +0800
commitf2f9bd2e7ac1372073644a4e30a5d99e8c57fbb1 (patch)
tree98ff3c9137cdce1a44b65dc7dc89a7a72f70b9de /packages/deployer/test
parented0c64fdcf5c180107f54ad916c11c4901a4c01c (diff)
downloaddexon-sol-tools-f2f9bd2e7ac1372073644a4e30a5d99e8c57fbb1.tar.gz
dexon-sol-tools-f2f9bd2e7ac1372073644a4e30a5d99e8c57fbb1.tar.zst
dexon-sol-tools-f2f9bd2e7ac1372073644a4e30a5d99e8c57fbb1.zip
Revert "Merge pull request #493 from hysz/features/deployer/multipleCodebaseSupport"
This reverts commit 70d403e6f8c56bc70e6d3471a770b9bbff5d72e7, reversing changes made to 073bf738ddb271b6b4158798baf4cac3cb0608e9.
Diffstat (limited to 'packages/deployer/test')
-rw-r--r--packages/deployer/test/compiler_test.ts16
-rw-r--r--packages/deployer/test/compiler_utils_test.ts22
-rw-r--r--packages/deployer/test/deployer_test.ts16
-rw-r--r--packages/deployer/test/fixtures/contracts/Exchange.sol (renamed from packages/deployer/test/fixtures/contracts/main/Exchange.sol)6
-rw-r--r--packages/deployer/test/fixtures/contracts/TokenTransferProxy.sol (renamed from packages/deployer/test/fixtures/contracts/main/TokenTransferProxy.sol)6
5 files changed, 20 insertions, 46 deletions
diff --git a/packages/deployer/test/compiler_test.ts b/packages/deployer/test/compiler_test.ts
index 817a3b3f9..b03ae7935 100644
--- a/packages/deployer/test/compiler_test.ts
+++ b/packages/deployer/test/compiler_test.ts
@@ -3,13 +3,7 @@ import 'mocha';
import { Compiler } from '../src/compiler';
import { fsWrapper } from '../src/utils/fs_wrapper';
-import {
- CompilerOptions,
- ContractArtifact,
- ContractDirectory,
- ContractNetworkData,
- DoneCallback,
-} from '../src/utils/types';
+import { CompilerOptions, ContractArtifact, ContractNetworkData, DoneCallback } from '../src/utils/types';
import { exchange_binary } from './fixtures/exchange_bin';
import { constants } from './util/constants';
@@ -19,15 +13,11 @@ const expect = chai.expect;
describe('#Compiler', function() {
this.timeout(constants.timeoutMs);
const artifactsDir = `${__dirname}/fixtures/artifacts`;
- const mainContractDir: ContractDirectory = { path: `${__dirname}/fixtures/contracts/main`, namespace: 'main' };
- const baseContractDir: ContractDirectory = { path: `${__dirname}/fixtures/contracts/base`, namespace: 'base' };
- const contractDirs: Set<ContractDirectory> = new Set();
- contractDirs.add(mainContractDir);
- contractDirs.add(baseContractDir);
+ const contractsDir = `${__dirname}/fixtures/contracts`;
const exchangeArtifactPath = `${artifactsDir}/Exchange.json`;
const compilerOpts: CompilerOptions = {
artifactsDir,
- contractDirs,
+ contractsDir,
networkId: constants.networkId,
optimizerEnabled: constants.optimizerEnabled,
specifiedContracts: new Set(constants.specifiedContracts),
diff --git a/packages/deployer/test/compiler_utils_test.ts b/packages/deployer/test/compiler_utils_test.ts
index 5377d3308..246304858 100644
--- a/packages/deployer/test/compiler_utils_test.ts
+++ b/packages/deployer/test/compiler_utils_test.ts
@@ -47,34 +47,28 @@ describe('Compiler utils', () => {
});
describe('#parseDependencies', () => {
it('correctly parses Exchange dependencies', async () => {
- const exchangeSource = await fsWrapper.readFileAsync(`${__dirname}/fixtures/contracts/main/Exchange.sol`, {
+ const exchangeSource = await fsWrapper.readFileAsync(`${__dirname}/fixtures/contracts/Exchange.sol`, {
encoding: 'utf8',
});
- const sourceFileId = '/main/Exchange.sol';
- expect(parseDependencies(exchangeSource, sourceFileId)).to.be.deep.equal([
- '/main/TokenTransferProxy.sol',
- '/base/Token.sol',
- '/base/SafeMath.sol',
+ expect(parseDependencies(exchangeSource)).to.be.deep.equal([
+ 'TokenTransferProxy.sol',
+ 'Token.sol',
+ 'SafeMath.sol',
]);
});
it('correctly parses TokenTransferProxy dependencies', async () => {
const exchangeSource = await fsWrapper.readFileAsync(
- `${__dirname}/fixtures/contracts/main/TokenTransferProxy.sol`,
+ `${__dirname}/fixtures/contracts/TokenTransferProxy.sol`,
{
encoding: 'utf8',
},
);
- const sourceFileId = '/main/TokenTransferProxy.sol';
- expect(parseDependencies(exchangeSource, sourceFileId)).to.be.deep.equal([
- '/base/Token.sol',
- '/base/Ownable.sol',
- ]);
+ expect(parseDependencies(exchangeSource)).to.be.deep.equal(['Token.sol', 'Ownable.sol']);
});
// TODO: For now that doesn't work. This will work after we switch to a grammar-based parser
it.skip('correctly parses commented out dependencies', async () => {
const contractWithCommentedOutDependencies = `// import "./TokenTransferProxy.sol";`;
- const sourceFileId = '/main/TokenTransferProxy.sol';
- expect(parseDependencies(contractWithCommentedOutDependencies, sourceFileId)).to.be.deep.equal([]);
+ expect(parseDependencies(contractWithCommentedOutDependencies)).to.be.deep.equal([]);
});
});
});
diff --git a/packages/deployer/test/deployer_test.ts b/packages/deployer/test/deployer_test.ts
index a213932f9..238624220 100644
--- a/packages/deployer/test/deployer_test.ts
+++ b/packages/deployer/test/deployer_test.ts
@@ -4,13 +4,7 @@ import 'mocha';
import { Compiler } from '../src/compiler';
import { Deployer } from '../src/deployer';
import { fsWrapper } from '../src/utils/fs_wrapper';
-import {
- CompilerOptions,
- ContractArtifact,
- ContractDirectory,
- ContractNetworkData,
- DoneCallback,
-} from '../src/utils/types';
+import { CompilerOptions, ContractArtifact, ContractNetworkData, DoneCallback } from '../src/utils/types';
import { constructor_args, exchange_binary } from './fixtures/exchange_bin';
import { constants } from './util/constants';
@@ -20,15 +14,11 @@ const expect = chai.expect;
describe('#Deployer', () => {
const artifactsDir = `${__dirname}/fixtures/artifacts`;
+ const contractsDir = `${__dirname}/fixtures/contracts`;
const exchangeArtifactPath = `${artifactsDir}/Exchange.json`;
- const mainContractDir: ContractDirectory = { path: `${__dirname}/fixtures/contracts/main`, namespace: '' };
- const baseContractDir: ContractDirectory = { path: `${__dirname}/fixtures/contracts/base`, namespace: 'base' };
- const contractDirs: Set<ContractDirectory> = new Set();
- contractDirs.add(mainContractDir);
- contractDirs.add(baseContractDir);
const compilerOpts: CompilerOptions = {
artifactsDir,
- contractDirs,
+ contractsDir,
networkId: constants.networkId,
optimizerEnabled: constants.optimizerEnabled,
specifiedContracts: new Set(constants.specifiedContracts),
diff --git a/packages/deployer/test/fixtures/contracts/main/Exchange.sol b/packages/deployer/test/fixtures/contracts/Exchange.sol
index ea9ca3afa..1b6819700 100644
--- a/packages/deployer/test/fixtures/contracts/main/Exchange.sol
+++ b/packages/deployer/test/fixtures/contracts/Exchange.sol
@@ -1,6 +1,6 @@
/*
- Copyright 2018 ZeroEx Intl.
+ Copyright 2017 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -19,8 +19,8 @@
pragma solidity 0.4.14;
import "./TokenTransferProxy.sol";
-import "/base/Token.sol";
-import "/base/SafeMath.sol";
+import "./base/Token.sol";
+import "./base/SafeMath.sol";
/// @title Exchange - Facilitates exchange of ERC20 tokens.
/// @author Amir Bandeali - <amir@0xProject.com>, Will Warren - <will@0xProject.com>
diff --git a/packages/deployer/test/fixtures/contracts/main/TokenTransferProxy.sol b/packages/deployer/test/fixtures/contracts/TokenTransferProxy.sol
index 99d16cb57..90c8e7d66 100644
--- a/packages/deployer/test/fixtures/contracts/main/TokenTransferProxy.sol
+++ b/packages/deployer/test/fixtures/contracts/TokenTransferProxy.sol
@@ -1,6 +1,6 @@
/*
- Copyright 2018 ZeroEx Intl.
+ Copyright 2017 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -18,8 +18,8 @@
pragma solidity 0.4.14;
-import "/base/Token.sol";
-import "/base/Ownable.sol";
+import "./base/Token.sol";
+import "./base/Ownable.sol";
/// @title TokenTransferProxy - Transfers tokens on behalf of contracts that have been approved via decentralized governance.
/// @author Amir Bandeali - <amir@0xProject.com>, Will Warren - <will@0xProject.com>