mirror of
https://github.com/harttle/liquidjs.git
synced 2026-10-03 00:55:13 -07:00
test: add LiquidOptions#operators test
This commit is contained in:
committed by
Jun Yang
parent
6a7c280f04
commit
18055c8855
@@ -0,0 +1,25 @@
|
|||||||
|
import { expect } from 'chai'
|
||||||
|
import { Liquid, Operators } from '../../../src/liquid'
|
||||||
|
|
||||||
|
describe('LiquidOptions#operators', function () {
|
||||||
|
let engine: Liquid
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
engine = new Liquid({
|
||||||
|
operators: {
|
||||||
|
...Operators,
|
||||||
|
isFooBar: (l, r) => l === 'foo' && r === 'bar'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should evaluate the default operators', async function () {
|
||||||
|
const result = await engine.parseAndRender('{% if "foo" == "foo" %}True{% endif %}')
|
||||||
|
expect(result).to.equal('True')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should evaluate a custom operator', async function () {
|
||||||
|
const result = await engine.parseAndRender('{% if "foo" isFooBar "bar" %}True{% endif %}')
|
||||||
|
expect(result).to.equal('True')
|
||||||
|
})
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user