mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-19 06:20:38 -07:00
test: case for "." path handling
This commit is contained in:
@@ -35,7 +35,7 @@ describe('express()', function () {
|
|||||||
it('should respect express views(string)', function (done) {
|
it('should respect express views(string)', function (done) {
|
||||||
app.set('views', views)
|
app.set('views', views)
|
||||||
request(app).get('/include/bar')
|
request(app).get('/include/bar')
|
||||||
.expect('bar')
|
.expect('BAR')
|
||||||
.expect(200, done)
|
.expect(200, done)
|
||||||
})
|
})
|
||||||
it('should pass error when file not found', function (done) {
|
it('should pass error when file not found', function (done) {
|
||||||
@@ -63,7 +63,7 @@ describe('express()', function () {
|
|||||||
it('should respect express views (Array) when lookup', function (done) {
|
it('should respect express views (Array) when lookup', function (done) {
|
||||||
app.set('views', [views, partials])
|
app.set('views', [views, partials])
|
||||||
request(app).get('/include/bar')
|
request(app).get('/include/bar')
|
||||||
.expect('bar')
|
.expect('BAR')
|
||||||
.expect(200, done)
|
.expect(200, done)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -52,4 +52,14 @@ describe('#renderFile()', function () {
|
|||||||
})
|
})
|
||||||
return expect(engine.renderFile('/not/exist.html')).rejects.toThrow(/Failed to lookup "\/not\/exist.html" in "\/boo,\/root\/"/)
|
return expect(engine.renderFile('/not/exist.html')).rejects.toThrow(/Failed to lookup "\/not\/exist.html" in "\/boo,\/root\/"/)
|
||||||
})
|
})
|
||||||
|
it('should handle "." as cwd', async () => {
|
||||||
|
engine = new Liquid({
|
||||||
|
root: ['.'],
|
||||||
|
extname: '.html'
|
||||||
|
})
|
||||||
|
process.chdir(resolve(__dirname, '../stub/views'))
|
||||||
|
await expect(engine.renderFile('bar')).resolves.toEqual('BAR')
|
||||||
|
process.chdir(resolve(__dirname, '../stub/partials'))
|
||||||
|
await expect(engine.renderFile('bar')).resolves.toEqual('bar')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { normalize } from '../../../src/liquid-options'
|
import { normalize } from '../../../src/liquid-options'
|
||||||
|
|
||||||
describe('LiquidOptions#root', function () {
|
describe('LiquidOptions#root', function () {
|
||||||
describe('#normalize ()', function () {
|
describe('#normalize()', function () {
|
||||||
it('should normalize string typed root array', function () {
|
it('should normalize string typed root array', function () {
|
||||||
const options = normalize({ root: 'foo' })
|
const options = normalize({ root: 'foo' })
|
||||||
expect(options.root).toEqual(['foo'])
|
expect(options.root).toEqual(['foo'])
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
bar
|
BAR
|
||||||
Reference in New Issue
Block a user