mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-18 05:50:43 -07:00
chore: migrate test cases from Chai to Jest
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { Liquid } from '../../src/liquid'
|
||||
import { Drop } from '../../src/drop/drop'
|
||||
|
||||
class SettingsDrop extends Drop {
|
||||
private foo = 'FOO'
|
||||
public bar () {
|
||||
return 'BAR'
|
||||
}
|
||||
public liquidMethodMissing (key: string) {
|
||||
return key.toUpperCase()
|
||||
}
|
||||
}
|
||||
|
||||
describe('drop', function () {
|
||||
const settings = new SettingsDrop()
|
||||
let engine: Liquid
|
||||
beforeEach(function () {
|
||||
engine = new Liquid()
|
||||
})
|
||||
it('should support liquidMethodMissing', async function () {
|
||||
const src = `{{settings.foo}},{{settings.bar}},{{settings.coo}}`
|
||||
const html = await engine.parseAndRender(src, { settings })
|
||||
return expect(html).toBe('FOO,BAR,COO')
|
||||
})
|
||||
|
||||
describe('BlandDrop', function () {
|
||||
it('should test blank strings', async function () {
|
||||
const src = `
|
||||
{% unless settings.fpHeading == blank %}
|
||||
<h1>{{ settings.fpHeading }}</h1>
|
||||
{% endunless %}`
|
||||
var ctx = { settings: { fpHeading: '' } }
|
||||
const html = await engine.parseAndRender(src, ctx)
|
||||
return expect(html).toMatch(/^\s+$/)
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user