mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
refactor: rewrite expression evaluation, fix #130
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { isTruthy } from '../../../src/render/boolean'
|
||||
import { expect } from 'chai'
|
||||
|
||||
describe('boolean', async function () {
|
||||
describe('.isTruthy()', async function () {
|
||||
// Spec: https://shopify.github.io/liquid/basics/truthy-and-falsy/
|
||||
it('true is truthy', function () {
|
||||
expect(isTruthy(true)).to.be.true
|
||||
})
|
||||
it('false is falsy', function () {
|
||||
expect(isTruthy(false)).to.be.false
|
||||
})
|
||||
it('null is falsy', function () {
|
||||
expect(isTruthy(null)).to.be.false
|
||||
})
|
||||
it('"foo" is truthy', function () {
|
||||
expect(isTruthy('foo')).to.be.true
|
||||
})
|
||||
it('"" is truthy', function () {
|
||||
expect(isTruthy('')).to.be.true
|
||||
})
|
||||
it('0 is truthy', function () {
|
||||
expect(isTruthy(0)).to.be.true
|
||||
})
|
||||
it('1 is truthy', function () {
|
||||
expect(isTruthy(1)).to.be.true
|
||||
})
|
||||
it('1.1 is truthy', function () {
|
||||
expect(isTruthy(1.1)).to.be.true
|
||||
})
|
||||
it('[1] is truthy', function () {
|
||||
expect(isTruthy([1])).to.be.true
|
||||
})
|
||||
it('[] is truthy', function () {
|
||||
expect(isTruthy([])).to.be.true
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user