Files
Jun YangandGitHub 660d9be55f feat: more flexible squared property read expression, fixes #643 (#646)
* fix: more flexible squared property read expression, fixes #643

* fix: unecessary error wrapping in browser bundles

* style: update code style and types

* perf: use token.value when evalToken
2023-08-23 00:45:49 +08:00

25 lines
826 B
TypeScript

const LiquidUMD = require('../../dist/liquid.browser.umd.js').Liquid
describe('browser', function () {
it('should yield unclosed output error', () => {
const engine = new LiquidUMD()
return expect(engine.parseAndRender('{{huh')).rejects.toMatchObject({
message: 'output "{{huh" not closed, line:1, col:1'
})
})
it('should throw tokenization error for invalid filter syntax', async () => {
const engine = new LiquidUMD()
const message = 'expected filter name, line:1, col:10'
const stack = [
'>> 1| {{ foo | ^ }}',
' ^',
`TokenizationError: ${message}`
].join('\n')
await expect(engine.parseAndRender('{{ foo | ^ }}')).rejects.toMatchObject({
message,
stack: expect.stringContaining(stack),
name: 'TokenizationError'
})
})
})