diff options
Diffstat (limited to 'packages/deployer/test/compiler_utils_test.ts')
-rw-r--r-- | packages/deployer/test/compiler_utils_test.ts | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/packages/deployer/test/compiler_utils_test.ts b/packages/deployer/test/compiler_utils_test.ts index 5377d3308..e2b95f289 100644 --- a/packages/deployer/test/compiler_utils_test.ts +++ b/packages/deployer/test/compiler_utils_test.ts @@ -47,34 +47,31 @@ describe('Compiler utils', () => { }); describe('#parseDependencies', () => { it('correctly parses Exchange dependencies', async () => { - const exchangeSource = await fsWrapper.readFileAsync(`${__dirname}/fixtures/contracts/main/Exchange.sol`, { + const path = `${__dirname}/fixtures/contracts/Exchange.sol`; + const source = await fsWrapper.readFileAsync(path, { 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({ source, path })).to.be.deep.equal([ + 'zeppelin-solidity/contracts/token/ERC20/ERC20.sol', + '/home/circleci/repo/packages/deployer/lib/test/fixtures/contracts/TokenTransferProxy.sol', + '/home/circleci/repo/packages/deployer/lib/test/fixtures/contracts/base/SafeMath.sol', ]); }); it('correctly parses TokenTransferProxy dependencies', async () => { - const exchangeSource = await fsWrapper.readFileAsync( - `${__dirname}/fixtures/contracts/main/TokenTransferProxy.sol`, - { - encoding: 'utf8', - }, - ); - const sourceFileId = '/main/TokenTransferProxy.sol'; - expect(parseDependencies(exchangeSource, sourceFileId)).to.be.deep.equal([ - '/base/Token.sol', - '/base/Ownable.sol', + const path = `${__dirname}/fixtures/contracts/TokenTransferProxy.sol`; + const source = await fsWrapper.readFileAsync(path, { + encoding: 'utf8', + }); + expect(parseDependencies({ source, path })).to.be.deep.equal([ + 'zeppelin-solidity/contracts/ownership/Ownable.sol', + 'zeppelin-solidity/contracts/token/ERC20/ERC20.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([]); + const path = ''; + const source = `// import "./TokenTransferProxy.sol";`; + expect(parseDependencies({ path, source })).to.be.deep.equal([]); }); }); }); |