mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
Expose fs as an option to override the default implementations
This commit is contained in:
committed by
Jun Yang
parent
2ae8c37a4f
commit
edb2cc1f37
@@ -0,0 +1,21 @@
|
||||
import { expect } from 'chai'
|
||||
import Liquid from '../../../src/liquid'
|
||||
|
||||
describe('LiquidOptions#fs', function () {
|
||||
let engine: Liquid
|
||||
const fs = {
|
||||
exists: () => Promise.resolve(true),
|
||||
readFile: () => Promise.resolve('test file content'),
|
||||
resolve: () => 'resolved'
|
||||
}
|
||||
beforeEach(function () {
|
||||
engine = new Liquid({
|
||||
root: '/root/',
|
||||
fs
|
||||
})
|
||||
})
|
||||
it('should be used to read templates', function () {
|
||||
return engine.renderFile('files/foo')
|
||||
.then(x => expect(x).to.equal('test file content'))
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user