Skip to content

Commit e9d6c9e

Browse files
committed
refactor(unit tests): Commit WIP pattern parameter tests
1 parent 438c6b1 commit e9d6c9e

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

test/parameter_hunter_tests.js

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ engineLoader.loadAllEngines(config);
1616

1717
const testPatternsPath = path.resolve(__dirname, 'files', '_patterns');
1818

19-
tap.only('parameter hunter finds and extends templates', function (test) {
19+
tap.test('parameter hunter finds and extends templates', function (test) {
2020
//arrange
2121
const pl = util.fakePatternLab(testPatternsPath);
2222

@@ -33,13 +33,13 @@ tap.only('parameter hunter finds and extends templates', function (test) {
3333
//act
3434
parameter_hunter.find_parameters(testPattern, pl).then(() => {
3535
//assert
36-
test.equals(util.sanitized(testPattern.extendedTemplate), util.sanitized('<h1></h1><p>A life is like a garden. Perfect moments can be had, but not preserved, except in memory.</p>'));
36+
test.equals(util.sanitized(testPattern.extendedTemplate), util.sanitized('<h1>{{foo}}</h1><p>A life is like a garden. Perfect moments can be had, but not preserved, except in memory.</p>'));
3737
test.end();
3838
}).catch(test.threw);
3939
}).catch(test.threw);
4040
});
4141

42-
tap.test('parameter hunter finds partials with their own parameters and renders them too', function (test) {
42+
tap.only('parameter hunter finds partials with their own parameters and renders them too', function (test) {
4343
//arrange
4444
const pl = util.fakePatternLab(testPatternsPath);
4545

@@ -55,8 +55,25 @@ tap.test('parameter hunter finds partials with their own parameters and renders
5555
var p1 = processIterative(aPattern, pl);
5656
var p2 = processIterative(bPattern, pl);
5757
var p3 = processIterative(cPattern, pl);
58+
var p4 = parameter_hunter.find_parameters(cPattern, pl);
59+
60+
Promise.all([p1, p2, p3, p4]).then(() => {
61+
62+
//act
63+
// parameter_hunter.find_parameters(bPattern, pl).then(() => {
64+
// //assert
65+
// test.equals(util.sanitized(bPattern.extendedTemplate),
66+
// util.sanitized(`<b>b</b>
67+
// {{ #b }}
68+
// <i>b!</i>
69+
// {{ /b }}
70+
// <b>a</b>
71+
// <i>a!</i>`));
72+
// test.end();
73+
// });
74+
// });
75+
5876

59-
Promise.all([p1, p2]).then(() => {
6077
//act
6178
parameter_hunter.find_parameters(cPattern, pl).then(() => {
6279
//assert
@@ -72,7 +89,7 @@ tap.test('parameter hunter finds partials with their own parameters and renders
7289
});
7390

7491

75-
tap.only('parameter hunter finds and extends templates with mixed parameter and global data', function (test) {
92+
tap.test('parameter hunter finds and extends templates with mixed parameter and global data', function (test) {
7693
//arrange
7794
const pl = util.fakePatternLab(testPatternsPath, {
7895
data: {

0 commit comments

Comments
 (0)