chore: migrate test cases from Chai to Jest

This commit is contained in:
Harttle
2023-03-20 00:41:06 +08:00
committed by Jun Yang
parent dccb90c591
commit c6cde9cd10
97 changed files with 8163 additions and 26440 deletions
+30
View File
@@ -0,0 +1,30 @@
import { Liquid } from '../../../src/liquid'
describe('LiquidOptions#*_delimiter_*', function () {
it('should respect tag_delimiter_*', async function () {
const engine = new Liquid({
tagDelimiterLeft: '<%=',
tagDelimiterRight: '%>'
})
const html = await engine.parseAndRender('<%=if true%>foo<%=endif%> ')
return expect(html).toBe('foo ')
})
it('should respect output_delimiter_*', async function () {
const engine = new Liquid({
outputDelimiterLeft: '<<',
outputDelimiterRight: '>>'
})
const html = await engine.parseAndRender('<< "liquid" | capitalize >>')
return expect(html).toBe('Liquid')
})
it('should support trimming with tag_delimiter_* set', async function () {
const engine = new Liquid({
tagDelimiterLeft: '<%=',
tagDelimiterRight: '%>',
trimTagLeft: true,
trimTagRight: true
})
const html = await engine.parseAndRender(' <%=if true%> \tfoo\t <%=endif%> ')
return expect(html).toBe('foo')
})
})