mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
refactor: use promise.mapSeries
This commit is contained in:
@@ -6,18 +6,19 @@ chai.use(require("chai-as-promised"));
|
||||
describe('tags/capture', function() {
|
||||
var liquid = Liquid();
|
||||
|
||||
it('should support capture 1', function() {
|
||||
it('should support capture', function() {
|
||||
var src = '{% capture f %}{{"a" | capitalize}}{%endcapture%}{{f}}';
|
||||
return expect(liquid.parseAndRender(src))
|
||||
.to.eventually.equal('A');
|
||||
});
|
||||
it('should support capture 2', function() {
|
||||
|
||||
it('should throw on invalid identifier', function() {
|
||||
var src = '{% capture = %}{%endcapture%}';
|
||||
return expect(liquid.parseAndRender(src))
|
||||
.to.be.rejectedWith(/= not valid identifier/);
|
||||
});
|
||||
|
||||
it('should throw when for capture closed', function() {
|
||||
it('should throw when capture not closed', function() {
|
||||
var src = '{%capture c%}{{c}}';
|
||||
return expect(liquid.parseAndRender(src))
|
||||
.to.be.rejectedWith(/tag .* not closed/);
|
||||
|
||||
+2
-4
@@ -46,12 +46,10 @@ describe('tags/for', function() {
|
||||
|
||||
it('should support for with continue', function() {
|
||||
var src = '{% for i in (1..5) %}' +
|
||||
'{% if i == 4 %}{% continue %}' +
|
||||
'{% else %}{{ i }}' +
|
||||
'{% endif %}' +
|
||||
'{{i}}{% continue %}after' +
|
||||
'{% endfor %}';
|
||||
return expect(liquid.parseAndRender(src, ctx))
|
||||
.to.eventually.equal('1235');
|
||||
.to.eventually.equal('12345');
|
||||
});
|
||||
it('should support for with break', function() {
|
||||
src = '{% for i in (one..5) %}' +
|
||||
|
||||
@@ -2,7 +2,7 @@ const Liquid = require('../..');
|
||||
const mock = require('mock-fs');
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
const error = require('../../src/error.js');
|
||||
const ParseError = Liquid.Types.ParseError;
|
||||
chai.use(require("chai-as-promised"));
|
||||
|
||||
describe('tags/include', function() {
|
||||
@@ -52,7 +52,7 @@ describe('tags/include', function() {
|
||||
|
||||
it('should throw when illegal', function() {
|
||||
return expect(liquid.renderFile('/illegal.html')).to.
|
||||
be.rejectedWith(error.ParseError, /illegal token {%include%}/);
|
||||
be.rejectedWith(ParseError, /illegal token {%include%}/);
|
||||
});
|
||||
|
||||
it('should support include with relative path', function() {
|
||||
|
||||
@@ -2,7 +2,6 @@ const Liquid = require('../..');
|
||||
const mock = require('mock-fs');
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
const error = require('../../src/error.js');
|
||||
chai.use(require("chai-as-promised"));
|
||||
|
||||
describe('tags/layout', function() {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const Liquid = require('../..');
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
const error = require('../../src/error.js');
|
||||
chai.use(require("chai-as-promised"));
|
||||
|
||||
describe('tags/tablerow', function() {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
var chai = require("chai");
|
||||
var expect = chai.expect;
|
||||
var engine = require('..')(), ctx;
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
const mock = require('mock-fs');
|
||||
|
||||
var engine = require('../..')(), ctx;
|
||||
|
||||
function test(promise, cb){
|
||||
return promise
|
||||
.then((result) => {
|
||||
Reference in New Issue
Block a user