mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-17 21:40:39 -07:00
chore(TypeScript): refactor objects into classes
fix: `Nil`(null, undefined) now renders as empty string change: `parser.parseValue()` renamed to `parser.parseOutput` change: registered tags/filters become static and shared across different liquid instances
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import Liquid from '../../../src'
|
||||
import Liquid from '../../../src/liquid'
|
||||
import * as mock from 'mock-fs'
|
||||
import * as chai from 'chai'
|
||||
import * as path from 'path'
|
||||
@@ -4,7 +4,7 @@ const expect = chai.expect
|
||||
chai.use(require('chai-as-promised'))
|
||||
chai.use(require('sinon-chai'))
|
||||
|
||||
const P = require('../../../src/util/promise.js')
|
||||
const P = require('../../../src/util/promise')
|
||||
|
||||
describe('util/promise', function () {
|
||||
describe('.anySeries()', function () {
|
||||
@@ -126,7 +126,7 @@ describe('util/strftime', function () {
|
||||
})
|
||||
|
||||
function mockUTC () {
|
||||
const p = Date.prototype
|
||||
const p = Date.prototype as any
|
||||
|
||||
p._getHours = p.getHours
|
||||
p.getHours = p.getUTCHours
|
||||
@@ -139,7 +139,7 @@ function mockUTC () {
|
||||
}
|
||||
|
||||
function restoreUTC () {
|
||||
const p = Date.prototype
|
||||
const p = Date.prototype as any
|
||||
p.getHours = p._getHours
|
||||
p.getDays = p._getDays
|
||||
p.getTimezoneOffset = p._getTimezoneOffset
|
||||
@@ -21,7 +21,7 @@ describe('util/underscore', function () {
|
||||
expect(_.isError(new RenderError(new Error(), tpl))).to.be.true
|
||||
})
|
||||
it('should return true for RenderBreakError', function () {
|
||||
expect(_.isError(new RenderBreakError())).to.be.true
|
||||
expect(_.isError(new RenderBreakError(''))).to.be.true
|
||||
})
|
||||
})
|
||||
describe('.isString()', function () {
|
||||
@@ -45,11 +45,11 @@ describe('util/underscore', function () {
|
||||
it('should recursively call toLiquid()', function () {
|
||||
expect(_.stringify({ toLiquid: () => ({ toLiquid: () => 'foo' }) })).to.equal('foo')
|
||||
})
|
||||
it('should return "null" for null', function () {
|
||||
expect(_.stringify(null)).to.equal('null')
|
||||
it('should return "" for null', function () {
|
||||
expect(_.stringify(null)).to.equal('')
|
||||
})
|
||||
it('should return "undefined" for undefined', function () {
|
||||
expect(_.stringify(undefined)).to.equal('undefined')
|
||||
it('should return "" for undefined', function () {
|
||||
expect(_.stringify(undefined)).to.equal('')
|
||||
})
|
||||
it('should return regex string for RegExp', function () {
|
||||
const reg = /foo/g
|
||||
@@ -98,7 +98,7 @@ describe('util/underscore', function () {
|
||||
it('should return a range of integers', function () {
|
||||
expect(_.range(3, 5)).to.deep.equal([3, 4])
|
||||
})
|
||||
it('should treat start as 0 if omitted', function () {
|
||||
it('should start from 0 if begin omitted', function () {
|
||||
expect(_.range(3)).to.deep.equal([0, 1, 2])
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user