refactor: import babelify

This commit is contained in:
harttle
2018-08-17 01:32:16 +08:00
parent 87360d5207
commit fa7cd8f4ff
25 changed files with 102 additions and 89 deletions
+14 -13
View File
@@ -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')
})
})