test: cases for async variables

This commit is contained in:
Harttle
2022-05-03 13:31:25 +08:00
committed by Harttle
parent 463a165e5e
commit 2f6d84befc
4 changed files with 17 additions and 6 deletions
+5
View File
@@ -52,6 +52,11 @@ describe('Liquid', function () {
const src = '{{ foo }}'
return expect(engine.parseAndRender(src, {}, { strictVariables: true })).rejectedWith(/undefined variable/)
})
it('should support async variables in output', async () => {
const src = '{{ foo }}'
const html = await engine.parseAndRender(src, { foo: Promise.resolve('FOO') })
expect(html).to.equal('FOO')
})
})
describe('#express()', function () {
const liquid = new Liquid({ root: '/root' })