fix: default length for truncate and truncatewords

This commit is contained in:
harttle
2019-02-23 03:11:07 +08:00
parent 5b6100d12b
commit 56c7992b76
11 changed files with 91 additions and 34 deletions
+15
View File
@@ -0,0 +1,15 @@
import { normalize } from 'src/liquid-options'
import { expect } from 'chai'
describe('LiquidOptions', function () {
describe('#normalize ()', function () {
it('should normalize string typed root array', function () {
const options = normalize({root: 'foo'})
expect(options.root).to.eql(['foo'])
})
it('should normalize null typed root as empty array', function () {
const options = normalize({root: null} as any)
expect(options.root).to.eql([])
})
})
})
+10
View File
@@ -47,4 +47,14 @@ describe('Liquid', function () {
})
})
})
describe('#renderFile', function () {
it('should throw with lookup list when file not exist', function () {
const engine = new Liquid({
root: ['/boo', '/root/'],
extname: '.html'
})
return expect(engine.renderFile('/not/exist.html')).to
.be.rejectedWith(/Failed to lookup "\/not\/exist.html" in "\/boo,\/root\/"/)
})
})
})