mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-29 01:10:04 +02:00
awesome more test coverage
This commit is contained in:
parent
3d8e40851e
commit
f8fec430be
5 changed files with 128 additions and 40 deletions
|
@ -11,18 +11,18 @@ TreeCompare.dispatchFromLevel = function(levelBlob, treeToCompare) {
|
|||
TreeCompare.dispatch = function(levelBlob, goalTreeString, treeToCompare) {
|
||||
switch(true) {
|
||||
case !!levelBlob.compareOnlyMaster:
|
||||
return TreeCompare.compareBranchWithinTrees(current, goalTreeString, 'master');
|
||||
return TreeCompare.compareBranchWithinTrees(treeToCompare, goalTreeString, 'master');
|
||||
case !!levelBlob.compareOnlyBranches:
|
||||
return TreeCompare.compareAllBranchesWithinTrees(current, goalTreeString);
|
||||
return TreeCompare.compareAllBranchesWithinTrees(treeToCompare, goalTreeString);
|
||||
case !!levelBlob.compareAllBranchesHashAgnostic:
|
||||
return TreeCompare.compareAllBranchesWithinTreesHashAgnostic(current, goalTreeString);
|
||||
return TreeCompare.compareAllBranchesWithinTreesHashAgnostic(treeToCompare, goalTreeString);
|
||||
case !!levelBlob.compareOnlyMasterHashAgnostic:
|
||||
return TreeCompare.compareBranchesWithinTreesHashAgnostic(current, goalTreeString, ['master']);
|
||||
return TreeCompare.compareBranchesWithinTreesHashAgnostic(treeToCompare, goalTreeString, ['master']);
|
||||
case !!levelBlob.compareOnlyMasterHashAgnosticWithAsserts:
|
||||
return TreeCompare.compareBranchesWithinTreesHashAgnostic(current, goalTreeString, ['master']) &&
|
||||
TreeCompare.evalAsserts(current, levelBlob.goalAsserts);
|
||||
return TreeCompare.compareBranchesWithinTreesHashAgnostic(treeToCompare, goalTreeString, ['master']) &&
|
||||
TreeCompare.evalAsserts(treeToCompare, levelBlob.goalAsserts);
|
||||
default:
|
||||
return TreeCompare.compareAllBranchesWithinTreesAndHEAD(current, goalTreeString);
|
||||
return TreeCompare.compareAllBranchesWithinTreesAndHEAD(treeToCompare, goalTreeString);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -342,24 +342,7 @@ var Level = Sandbox.extend({
|
|||
// BIG TODO REALLY REFACTOR HAX HAX
|
||||
// ok so lets see if they solved it...
|
||||
var current = this.mainVis.gitEngine.exportTree();
|
||||
var solved;
|
||||
if (this.level.compareOnlyMaster) {
|
||||
solved = TreeCompare.compareBranchWithinTrees(current, this.level.goalTreeString, 'master');
|
||||
} else if (this.level.compareOnlyBranches) {
|
||||
solved = TreeCompare.compareAllBranchesWithinTrees(current, this.level.goalTreeString);
|
||||
} else if (this.level.compareAllBranchesHashAgnostic) {
|
||||
solved = TreeCompare.compareAllBranchesWithinTreesHashAgnostic(current, this.level.goalTreeString);
|
||||
} else if (this.level.compareOnlyMasterHashAgnostic) {
|
||||
solved = TreeCompare.compareBranchesWithinTreesHashAgnostic(current, this.level.goalTreeString, ['master']);
|
||||
} else if (this.level.compareOnlyMasterHashAgnosticWithAsserts) {
|
||||
solved = TreeCompare.compareBranchesWithinTreesHashAgnostic(current, this.level.goalTreeString, ['master']);
|
||||
solved = solved && TreeCompare.evalAsserts(
|
||||
current,
|
||||
this.level.goalAsserts
|
||||
);
|
||||
} else {
|
||||
solved = TreeCompare.compareAllBranchesWithinTreesAndHEAD(current, this.level.goalTreeString);
|
||||
}
|
||||
var solved = TreeCompare.dispatch(this.level, current);
|
||||
|
||||
if (!solved) {
|
||||
defer.resolve();
|
||||
|
|
|
@ -40,5 +40,8 @@ $(document).ready(function() {
|
|||
window.modules = toGlobalize;
|
||||
window.levelDropdown = toGlobalize.Main.getLevelDropdown();
|
||||
window.under = _;
|
||||
window.copyTree = function() {
|
||||
return toGlobalize.Main.getSandbox().mainVis.gitEngine.printAndCopyTree();
|
||||
};
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue