mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
refactor: import babelify
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
const chai = require('chai')
|
||||
import Liquid from '../../src'
|
||||
import chai from 'chai'
|
||||
|
||||
const expect = chai.expect
|
||||
const Liquid = require('../../src')
|
||||
chai.use(require('chai-as-promised'))
|
||||
|
||||
describe('strict options', function () {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
const Liquid = require('../..')
|
||||
const chai = require('chai')
|
||||
import Liquid from '../../src/index'
|
||||
import chai from 'chai'
|
||||
|
||||
const expect = chai.expect
|
||||
chai.use(require('chai-as-promised'))
|
||||
|
||||
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
const Liquid = require('../..')
|
||||
const chai = require('chai')
|
||||
import Liquid from '../../src'
|
||||
import chai from 'chai'
|
||||
|
||||
const expect = chai.expect
|
||||
chai.use(require('chai-as-promised'))
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const Liquid = require('../..')
|
||||
const chai = require('chai')
|
||||
import Liquid from '../../src'
|
||||
import chai from 'chai'
|
||||
|
||||
const expect = chai.expect
|
||||
chai.use(require('chai-as-promised'))
|
||||
|
||||
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
const Liquid = require('../..')
|
||||
const chai = require('chai')
|
||||
import Liquid from '../../src'
|
||||
import chai from 'chai'
|
||||
|
||||
const expect = chai.expect
|
||||
chai.use(require('chai-as-promised'))
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
const Liquid = require('../..')
|
||||
const chai = require('chai')
|
||||
import Liquid from '../../src'
|
||||
import chai from 'chai'
|
||||
|
||||
const expect = chai.expect
|
||||
chai.use(require('chai-as-promised'))
|
||||
|
||||
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
const Liquid = require('../..')
|
||||
const chai = require('chai')
|
||||
import Liquid from '../../src'
|
||||
import chai from 'chai'
|
||||
|
||||
const expect = chai.expect
|
||||
chai.use(require('chai-as-promised'))
|
||||
|
||||
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
const Liquid = require('../..')
|
||||
const chai = require('chai')
|
||||
import Liquid from '../../src/index'
|
||||
import chai from 'chai'
|
||||
|
||||
const expect = chai.expect
|
||||
chai.use(require('chai-as-promised'))
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const Liquid = require('../..')
|
||||
const mock = require('mock-fs')
|
||||
const chai = require('chai')
|
||||
import Liquid from '../../src'
|
||||
import mock from 'mock-fs'
|
||||
import chai from 'chai'
|
||||
|
||||
const expect = chai.expect
|
||||
chai.use(require('chai-as-promised'))
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
const Liquid = require('../..')
|
||||
const chai = require('chai')
|
||||
import Liquid from '../../src'
|
||||
import chai from 'chai'
|
||||
|
||||
const expect = chai.expect
|
||||
chai.use(require('chai-as-promised'))
|
||||
|
||||
|
||||
+4
-3
@@ -1,6 +1,7 @@
|
||||
const Liquid = require('../..')
|
||||
const mock = require('mock-fs')
|
||||
const chai = require('chai')
|
||||
import Liquid from '../../src'
|
||||
import mock from 'mock-fs'
|
||||
import chai from 'chai'
|
||||
|
||||
const expect = chai.expect
|
||||
chai.use(require('chai-as-promised'))
|
||||
|
||||
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
const Liquid = require('../..')
|
||||
const chai = require('chai')
|
||||
import Liquid from '../../src'
|
||||
import chai from 'chai'
|
||||
|
||||
const expect = chai.expect
|
||||
chai.use(require('chai-as-promised'))
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const Liquid = require('../..')
|
||||
const chai = require('chai')
|
||||
import Liquid from '../../src'
|
||||
import chai from 'chai'
|
||||
|
||||
const expect = chai.expect
|
||||
chai.use(require('chai-as-promised'))
|
||||
|
||||
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
const Liquid = require('../..')
|
||||
const chai = require('chai')
|
||||
import Liquid from '../../src'
|
||||
import chai from 'chai'
|
||||
|
||||
const expect = chai.expect
|
||||
chai.use(require('chai-as-promised'))
|
||||
|
||||
|
||||
+9
-7
@@ -1,11 +1,13 @@
|
||||
const chai = require('chai')
|
||||
import Liquid from '../../src'
|
||||
import mock from 'mock-fs'
|
||||
import chai from 'chai'
|
||||
import path from 'path'
|
||||
|
||||
const expect = chai.expect
|
||||
const mock = require('mock-fs')
|
||||
const path = require('path')
|
||||
chai.use(require('chai-as-promised'))
|
||||
|
||||
let engine = require('../..')()
|
||||
let strictEngine = require('../..')({
|
||||
let engine = Liquid()
|
||||
let strictEngine = Liquid({
|
||||
strict_variables: true,
|
||||
strict_filters: true
|
||||
})
|
||||
@@ -95,7 +97,7 @@ describe('error', function () {
|
||||
|
||||
describe('RenderError', function () {
|
||||
beforeEach(function () {
|
||||
engine = require('../..')({
|
||||
engine = Liquid({
|
||||
root: '/'
|
||||
})
|
||||
engine.registerTag('throwingTag', {
|
||||
@@ -269,7 +271,7 @@ describe('error', function () {
|
||||
|
||||
describe('ParseError', function () {
|
||||
beforeEach(function () {
|
||||
engine = require('../..')()
|
||||
engine = Liquid()
|
||||
engine.registerTag('throwsOnParse', {
|
||||
parse: function () {
|
||||
throw new Error('intended parse error')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import chai from 'chai'
|
||||
import sinon from 'sinon'
|
||||
import Errors from '../../src/util/error.js'
|
||||
import {RenderError, RenderBreakError} from '../../src/util/error.js'
|
||||
import _ from '../../src/util/underscore.js'
|
||||
|
||||
const expect = chai.expect
|
||||
@@ -17,10 +17,10 @@ describe('util/underscore', function () {
|
||||
input: 'xx'
|
||||
}
|
||||
}
|
||||
expect(_.isError(new Errors.RenderError(new Error(), tpl))).to.be.true
|
||||
expect(_.isError(new RenderError(new Error(), tpl))).to.be.true
|
||||
})
|
||||
it('should return true for RenderBreakError', function () {
|
||||
expect(_.isError(new Errors.RenderBreakError())).to.be.true
|
||||
expect(_.isError(new RenderBreakError())).to.be.true
|
||||
})
|
||||
})
|
||||
describe('.isString()', function () {
|
||||
|
||||
+14
-13
@@ -1,6 +1,7 @@
|
||||
const chai = require('chai')
|
||||
import {resolve} from '../../src/util/url.js'
|
||||
import chai from 'chai'
|
||||
|
||||
const expect = chai.expect
|
||||
const url = require('../../src/util/url.js')
|
||||
|
||||
describe('util/url', function () {
|
||||
if (process.version.match(/^v(\d+)/)[1] < 8) {
|
||||
@@ -22,41 +23,41 @@ describe('util/url', function () {
|
||||
describe('resolve', function () {
|
||||
describe('root', function () {
|
||||
it('should support width relative path', function () {
|
||||
expect(url.resolve('./views', 'foo'))
|
||||
expect(resolve('./views', 'foo'))
|
||||
.to.equal('https://example.com/foo/bar/views/foo')
|
||||
expect(url.resolve('./views/', 'foo'))
|
||||
expect(resolve('./views/', 'foo'))
|
||||
.to.equal('https://example.com/foo/bar/views/foo')
|
||||
})
|
||||
it('should support width absolute path', function () {
|
||||
expect(url.resolve('/views', 'foo'))
|
||||
expect(resolve('/views', 'foo'))
|
||||
.to.equal('https://example.com/views/foo')
|
||||
expect(url.resolve('/views/', 'foo'))
|
||||
expect(resolve('/views/', 'foo'))
|
||||
.to.equal('https://example.com/views/foo')
|
||||
})
|
||||
it('should support with empty', function () {
|
||||
expect(url.resolve('', 'page.html'))
|
||||
expect(resolve('', 'page.html'))
|
||||
.to.equal('https://example.com/foo/bar/page.html')
|
||||
})
|
||||
it('should support with url', function () {
|
||||
expect(url.resolve('https://example.com/views', 'page.html'))
|
||||
expect(resolve('https://example.com/views', 'page.html'))
|
||||
.to.equal('https://example.com/views/page.html')
|
||||
expect(url.resolve('https://example.com/views/', 'page.html'))
|
||||
expect(resolve('https://example.com/views/', 'page.html'))
|
||||
.to.equal('https://example.com/views/page.html')
|
||||
})
|
||||
it('should get the first value when argument is array', function () {
|
||||
expect(url.resolve(['https://example.com/views', 'https://google.com/views'], 'page.html'))
|
||||
expect(resolve(['https://example.com/views', 'https://google.com/views'], 'page.html'))
|
||||
.to.equal('https://example.com/views/page.html')
|
||||
expect(url.resolve(['https://example.com/views/', 'https://google.com/views'], 'page.html'))
|
||||
expect(resolve(['https://example.com/views/', 'https://google.com/views'], 'page.html'))
|
||||
.to.equal('https://example.com/views/page.html')
|
||||
})
|
||||
})
|
||||
describe('path', function () {
|
||||
it('should support width relative path', function () {
|
||||
expect(url.resolve('./views/', 'page.html'))
|
||||
expect(resolve('./views/', 'page.html'))
|
||||
.to.equal('https://example.com/foo/bar/views/page.html')
|
||||
})
|
||||
it('should support with absolute path', function () {
|
||||
expect(url.resolve('/views/', '/page.html'))
|
||||
expect(resolve('/views/', '/page.html'))
|
||||
.to.equal('https://example.com/page.html')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
const chai = require('chai')
|
||||
const expect = chai.expect
|
||||
const Liquid = require('..')
|
||||
import chai from 'chai'
|
||||
import Liquid from '../src'
|
||||
|
||||
const liquid = new Liquid()
|
||||
const expect = chai.expect
|
||||
chai.use(require('chai-as-promised'))
|
||||
|
||||
const cases = [
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import Liquid from '..'
|
||||
import Liquid from '../src'
|
||||
import sinon from 'sinon'
|
||||
import chai from 'chai'
|
||||
const expect = chai.expect
|
||||
|
||||
Reference in New Issue
Block a user