test: updated remapImports tests re: `.embark/contracts/node_modules` -> `.embark/node_modules`

Related to #2132
This commit is contained in:
Michael Bradley, Jr 2019-12-12 17:28:23 -06:00
parent b25ade64f0
commit b630a71f7f
1 changed files with 9 additions and 9 deletions

View File

@ -157,26 +157,26 @@ describe('embark.RemapImports', function () {
it("should find and add remappings for all recursive imports", (done) => { it("should find and add remappings for all recursive imports", (done) => {
expect(file.importRemappings[0]).to.deep.equal({ expect(file.importRemappings[0]).to.deep.equal({
prefix: "embark-test-contract-0/recursive_test_3.sol", prefix: "embark-test-contract-0/recursive_test_3.sol",
target: path.normalize(dappPath(".embark/contracts/node_modules/embark-test-contract-0/recursive_test_3.sol")) target: path.normalize(dappPath(".embark/node_modules/embark-test-contract-0/recursive_test_3.sol"))
}); });
expect(file.importRemappings[1]).to.deep.equal({ expect(file.importRemappings[1]).to.deep.equal({
prefix: "embark-test-contract-1/recursive_test_4.sol", prefix: "embark-test-contract-1/recursive_test_4.sol",
target: path.normalize(dappPath(".embark/contracts/node_modules/embark-test-contract-1/recursive_test_4.sol")) target: path.normalize(dappPath(".embark/node_modules/embark-test-contract-1/recursive_test_4.sol"))
}); });
done(); done();
}); });
it("should update the contract content to use the remapped imports", function (done) { it("should update the contract content to use the remapped imports", function (done) {
expect(content).to.not.contain("./embark-test-contract-0/recursive_test_3.sol"); expect(content).to.not.contain("./embark-test-contract-0/recursive_test_3.sol");
expect(content).to.contain(path.normalize(".embark/contracts/node_modules/embark-test-contract-0/recursive_test_3.sol").replace(/\\/g, "/")); expect(content).to.contain(path.normalize(".embark/node_modules/embark-test-contract-0/recursive_test_3.sol").replace(/\\/g, "/"));
let contractFromFilesystem = fsNode.readFileSync(dappPath(".embark/contracts/recursive_test_node_modules.sol")).toString(); let contractFromFilesystem = fsNode.readFileSync(dappPath(".embark/contracts/recursive_test_node_modules.sol")).toString();
expect(contractFromFilesystem).to.not.contain("import \"embark-test-contract-0/recursive_test_3.sol\""); expect(contractFromFilesystem).to.not.contain("import \"embark-test-contract-0/recursive_test_3.sol\"");
expect(contractFromFilesystem).to.contain(`import "${path.normalize(dappPath(".embark/contracts/node_modules/embark-test-contract-0/recursive_test_3.sol")).replace(/\\/g, "/")}"`); expect(contractFromFilesystem).to.contain(`import "${path.normalize(dappPath(".embark/node_modules/embark-test-contract-0/recursive_test_3.sol")).replace(/\\/g, "/")}"`);
contractFromFilesystem = fsNode.readFileSync(dappPath(".embark/contracts/node_modules/embark-test-contract-0/recursive_test_3.sol")).toString(); contractFromFilesystem = fsNode.readFileSync(dappPath(".embark/node_modules/embark-test-contract-0/recursive_test_3.sol")).toString();
expect(contractFromFilesystem).to.not.contain("import \"embark-test-contract-1/recursive_test_4.sol\""); expect(contractFromFilesystem).to.not.contain("import \"embark-test-contract-1/recursive_test_4.sol\"");
expect(contractFromFilesystem).to.contain(`import "${path.normalize(dappPath(".embark/contracts/node_modules/embark-test-contract-1/recursive_test_4.sol")).replace(/\\/g, "/")}"`); expect(contractFromFilesystem).to.contain(`import "${path.normalize(dappPath(".embark/node_modules/embark-test-contract-1/recursive_test_4.sol")).replace(/\\/g, "/")}"`);
done(); done();
}); });