diff options
Diffstat (limited to 'lib/templating/__tests__')
-rw-r--r-- | lib/templating/__tests__/conrefsLoader.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/templating/__tests__/conrefsLoader.js b/lib/templating/__tests__/conrefsLoader.js index 8bf4ad2..bcbee05 100644 --- a/lib/templating/__tests__/conrefsLoader.js +++ b/lib/templating/__tests__/conrefsLoader.js @@ -35,6 +35,44 @@ describe('ConrefsLoader', function() { }); }); + describe('Local', function() { + var engine = TemplateEngine({ + loader: new ConrefsLoader(dirName) + }); + + describe('Relative', function() { + it('should resolve basic relative filepath', function() { + return renderTemplate(engine, fileName, '{% include "include.md" %}') + .then(function(out) { + expect(out.getContent()).toBe('Hello World'); + }); + }); + + it('should resolve basic parent filepath', function() { + return renderTemplate(engine, path.join(dirName, 'hello/test.md'), '{% include "../include.md" %}') + .then(function(out) { + expect(out.getContent()).toBe('Hello World'); + }); + }); + }); + + describe('Absolute', function() { + it('should resolve absolute filepath', function() { + return renderTemplate(engine, fileName, '{% include "/include.md" %}') + .then(function(out) { + expect(out.getContent()).toBe('Hello World'); + }); + }); + + it('should resolve absolute filepath when in a directory', function() { + return renderTemplate(engine, path.join(dirName, 'hello/test.md'), '{% include "/include.md" %}') + .then(function(out) { + expect(out.getContent()).toBe('Hello World'); + }); + }); + }); + }); + describe('transform', function() { function transform(filePath, source) { return 'test-' + source + '-endtest'; |