test: cover parseFilters in template/value.ts

This commit is contained in:
harttle
2019-03-06 01:46:35 +08:00
parent 998832c772
commit ad0930f152
2 changed files with 7 additions and 1 deletions
@@ -0,0 +1,17 @@
import { test, liquid } from '../../stub/render'
describe('liquid#registerFilter()', function () {
describe('object arguments', function () {
liquid.registerFilter('obj_test', function () {
return JSON.stringify(arguments)
})
it('should support object', () => test(
`{{ "a" | obj_test: k1: "v1", k2: foo }}`,
'{"0":"a","1":["k1","v1"],"2":["k2","bar"]}'
))
it('should support mixed object', () => test(
`{{ "a" | obj_test: "something", k1: "v1", k2: foo }}`,
'{"0":"a","1":"something","2":["k1","v1"],"3":["k2","bar"]}'
))
})
})