Skip to content

Commit 81f9eb6

Browse files
committed
test coverage for new keys
1 parent cebf84f commit 81f9eb6

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

test/files/_patterns/00-test/01-bar.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
status: complete
3+
title: An Atom Walks Into a Bar
4+
joke: bad
35
---
46
## A Simple Bit of Markup
57

test/pattern_assembler_tests.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,3 +768,39 @@ tap.test('hidden patterns can be called by their nice names', function(test){
768768
test.equals(util.sanitized(testPattern.render()), util.sanitized('Hello there! Here\'s the hidden atom: [This is the hidden atom]'), 'hidden pattern rendered output not as expected');
769769
test.end();
770770
});
771+
772+
tap.test('parses pattern title correctly when frontmatter present', function(test){
773+
var util = require('./util/test_utils.js');
774+
775+
//arrange
776+
var testPatternsPath = path.resolve(__dirname, 'files', '_patterns');
777+
var pl = util.fakePatternLab(testPatternsPath);
778+
var pattern_assembler = new pa();
779+
780+
//act
781+
var testPatternPath = path.join('00-test', '01-bar.mustache');
782+
var testPattern = pattern_assembler.process_pattern_iterative(testPatternPath, pl);
783+
pattern_assembler.process_pattern_recursive(testPatternPath, pl);
784+
785+
//assert
786+
test.equals(testPattern.patternName, 'An Atom Walks Into a Bar','patternName not overridden');
787+
test.end();
788+
});
789+
790+
tap.test('parses pattern extra frontmatter correctly when frontmatter present', function(test){
791+
var util = require('./util/test_utils.js');
792+
793+
//arrange
794+
var testPatternsPath = path.resolve(__dirname, 'files', '_patterns');
795+
var pl = util.fakePatternLab(testPatternsPath);
796+
var pattern_assembler = new pa();
797+
798+
//act
799+
var testPatternPath = path.join('00-test', '01-bar.mustache');
800+
var testPattern = pattern_assembler.process_pattern_iterative(testPatternPath, pl);
801+
pattern_assembler.process_pattern_recursive(testPatternPath, pl);
802+
803+
//assert
804+
test.equals(testPattern.allMarkdown.joke, 'bad','extra key not added');
805+
test.end();
806+
});

0 commit comments

Comments
 (0)