mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-19 22:40:48 -07:00
chore: migrate test cases from Chai to Jest
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import { Liquid } from '../../../src/liquid'
|
||||
|
||||
describe('LiquidOptions#*outputEscape*', function () {
|
||||
it('when outputEscape is not set', async function () {
|
||||
const engine = new Liquid()
|
||||
const html = await engine.parseAndRender('{{"<"}}')
|
||||
expect(html).toBe('<')
|
||||
})
|
||||
|
||||
it('should escape when outputEscape="escape"', async function () {
|
||||
const engine = new Liquid({
|
||||
outputEscape: 'escape'
|
||||
})
|
||||
const html = await engine.parseAndRender('{{"<"}}')
|
||||
expect(html).toBe('<')
|
||||
})
|
||||
|
||||
it('should json stringify when outputEscape="json"', async function () {
|
||||
const engine = new Liquid({
|
||||
outputEscape: 'json'
|
||||
})
|
||||
const html = await engine.parseAndRender('{{"<"}}')
|
||||
expect(html).toBe('"<"')
|
||||
})
|
||||
|
||||
it('should support outputEscape=Function', async function () {
|
||||
const engine = new Liquid({
|
||||
outputEscape: (v: any) => `{${v}}`
|
||||
})
|
||||
const html = await engine.parseAndRender('{{"<"}}')
|
||||
expect(html).toBe('{<}')
|
||||
})
|
||||
|
||||
it('should skip escape for output with filter "| raw"', async function () {
|
||||
const engine = new Liquid({
|
||||
outputEscape: 'escape'
|
||||
})
|
||||
const html = await engine.parseAndRender('{{"<" | raw}}')
|
||||
expect(html).toBe('<')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user