Skip to content

Commit

Permalink
added two patternState unit tests as part of #97
Browse files Browse the repository at this point in the history
  • Loading branch information
bmuenzenmeyer committed Dec 5, 2015
1 parent cfedea6 commit 800f3b9
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/pattern_assembler_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,46 @@
}
test.equals(foundIgnoredPattern, false);
test.done();
},
'setState - applies any patternState matching the pattern' : function(test){
//arrange
var pa = require('../builder/pattern_assembler');
var pattern_assembler = new pa();
var patternlab = {};
patternlab.config = {};
patternlab.config.patternStates = {};
patternlab.config.patternStates["homepage-emergency"] = "inprogress";

var pattern = {
patternName: "homepage-emergency"
};

//act
pattern_assembler.setPatternState(pattern, patternlab);

//assert
test.equals(pattern.patternState, "inprogress");
test.done();
},
'setState - does not apply any patternState if nothing matches the pattern' : function(test){
//arrange
var pa = require('../builder/pattern_assembler');
var pattern_assembler = new pa();
var patternlab = {};
patternlab.config = {};
patternlab.config.patternStates = {};
patternlab.config.patternStates["homepage-emergency"] = "inprogress";

var pattern = {
patternName: "homepage"
};

//act
pattern_assembler.setPatternState(pattern, patternlab);

//assert
test.equals(pattern.patternState, "");
test.done();
}
};
}());

0 comments on commit 800f3b9

Please # to comment.