mirror of https://github.com/embarklabs/embark.git
fix tests using new dependencies
This commit is contained in:
parent
4298e18655
commit
150b5170c4
|
@ -266,14 +266,17 @@ class ContractsManager {
|
||||||
let className;
|
let className;
|
||||||
|
|
||||||
function getDependencyCount(contractName, cycleDetector) {
|
function getDependencyCount(contractName, cycleDetector) {
|
||||||
|
if (!self.contracts[contractName]) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (self.contracts[contractName].dependencyCount || self.contracts[contractName].dependencyCount === 0) {
|
||||||
|
// Already have that count
|
||||||
|
return self.contracts[contractName].dependencyCount;
|
||||||
|
}
|
||||||
if (!self.contractDependencies[contractName] || !self.contractDependencies[contractName].length) {
|
if (!self.contractDependencies[contractName] || !self.contractDependencies[contractName].length) {
|
||||||
self.contracts[contractName].dependencyCount = 0;
|
self.contracts[contractName].dependencyCount = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (self.contracts[contractName].dependencyCount) {
|
|
||||||
// Already have that count
|
|
||||||
return self.contracts[contractName].dependencyCount;
|
|
||||||
}
|
|
||||||
let total = self.contractDependencies[contractName].length;
|
let total = self.contractDependencies[contractName].length;
|
||||||
self.contractDependencies[contractName].some(dependencyName => {
|
self.contractDependencies[contractName].some(dependencyName => {
|
||||||
if (cycleDetector.indexOf(dependencyName) > -1) {
|
if (cycleDetector.indexOf(dependencyName) > -1) {
|
||||||
|
|
|
@ -123,6 +123,10 @@ class Test {
|
||||||
|
|
||||||
this.engine.contractsManager.build(() => {
|
this.engine.contractsManager.build(() => {
|
||||||
self.builtContracts = cloneDeep(self.engine.contractsManager.contracts);
|
self.builtContracts = cloneDeep(self.engine.contractsManager.contracts);
|
||||||
|
let className;
|
||||||
|
for (className in self.builtContracts) {
|
||||||
|
self.builtContracts[className].dependencyCount = null;
|
||||||
|
}
|
||||||
self.compiledContracts = cloneDeep(self.engine.contractsManager.compiledContracts);
|
self.compiledContracts = cloneDeep(self.engine.contractsManager.compiledContracts);
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
|
@ -211,6 +215,7 @@ class Test {
|
||||||
function resetContracts(next) {
|
function resetContracts(next) {
|
||||||
self.engine.contractsManager.contracts = cloneDeep(self.builtContracts);
|
self.engine.contractsManager.contracts = cloneDeep(self.builtContracts);
|
||||||
self.engine.contractsManager.compiledContracts = cloneDeep(self.compiledContracts);
|
self.engine.contractsManager.compiledContracts = cloneDeep(self.compiledContracts);
|
||||||
|
self.engine.contractsManager.contractDependencies = {};
|
||||||
next();
|
next();
|
||||||
},
|
},
|
||||||
function deploy(next) {
|
function deploy(next) {
|
||||||
|
|
Loading…
Reference in New Issue