feature: template file lookup error message

This commit is contained in:
harttle
2016-11-01 00:22:41 +08:00
parent 9961afa3dd
commit f8269f4d20
4 changed files with 44 additions and 12 deletions
+22
View File
@@ -0,0 +1,22 @@
const chai = require("chai");
const expect = chai.expect;
const fs = require('../../src/util/fs.js');
const pathResolve = fs.pathResolve;
describe('fs', function() {
describe('.pathResolve(root, path)', function() {
it('should accept root with no trailing slash', function() {
expect(pathResolve('/root', 'files/foo.html')).to.equal('/root/files/foo.html');
});
it('should accept root with trailing slash', function() {
expect(pathResolve('/root/', 'files/foo.html')).to.equal('/root/files/foo.html');
});
it('should accept dot path', function() {
expect(pathResolve('/root', './foo.html')).to.equal('/root/foo.html');
});
it('should accept double-dot path', function() {
expect(pathResolve('/root', 'files/../foo.html')).to.equal('/root/foo.html');
});
});
});