Skip to content

Commit

Permalink
test: add LiquidOptions#operators test
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonEtco authored and harttle committed Feb 4, 2021
1 parent 6a7c280 commit 18055c8
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/integration/liquid/operators-option.ts
Original file line number Diff line number Diff line change
@@ -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')
})
})

0 comments on commit 18055c8

Please sign in to comment.