mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
Changes including: - will not call fs.resolve when normalizing `fs` - removed hardcoded `/` - mandatory `fs.dirname` for relative reference - mandatory `fs.sep`, defaults to '/'
This commit is contained in:
@@ -114,4 +114,19 @@ describe('Issues', function () {
|
||||
const html = await engine.render(tpl, { date: '2021-10-06T15:31:00+08:00' })
|
||||
expect(html).to.equal('2021-10-06 17:31 PM +1000')
|
||||
})
|
||||
it('#412 Pass root as it is to `resolve`', async () => {
|
||||
const engine = new Liquid({
|
||||
root: '/tmp',
|
||||
fs: {
|
||||
readFileSync: (file: string) => file,
|
||||
async readFile (file: string) { return 'foo' },
|
||||
existsSync (file: string) { return true },
|
||||
async exists (file: string) { return true },
|
||||
resolve: (dir: string, file: string) => dir + '/' + file
|
||||
}
|
||||
})
|
||||
const tpl = engine.parse('{% include "foo.liquid" %}')
|
||||
const html = await engine.renderSync(tpl)
|
||||
expect(html).to.equal('/tmp/foo.liquid')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user