Files
liquidjs/test/liquid.js
T
2016-06-19 11:16:36 +08:00

32 lines
633 B
JavaScript

const chai = require("chai");
const expect = chai.expect;
var liquid = require('..')(),
ctx;
function test(src, dst) {
ctx = {
date: new Date(),
foo: 'bar',
arr: [-2, 'a'],
obj: {
foo: 'bar'
},
posts: [{
category: 'foo'
}, {
category: 'bar'
}]
};
expect(liquid.render(src, ctx)).to.equal(dst);
}
describe('liquid', function() {
it('should output object', function() {
test('{{obj}}', '{"foo":"bar"}');
});
it('should output array', function() {
test('{{arr}}', '[-2,"a"]');
});
});