mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-17 06:01:34 +00:00
Fix test for node v4
This commit is contained in:
parent
d3643b44d4
commit
2d6ac069fd
@ -1,5 +1,6 @@
|
|||||||
import test from 'ava'
|
import test from 'ava'
|
||||||
const utils = require('../lib/utils')
|
const utils = require('../lib/utils')
|
||||||
|
const ansiHTML = require('ansi-html')
|
||||||
|
|
||||||
test('encodeHtml', t => {
|
test('encodeHtml', t => {
|
||||||
const html = '<h1>Hello</h1>'
|
const html = '<h1>Hello</h1>'
|
||||||
@ -15,6 +16,10 @@ test('getContext', t => {
|
|||||||
t.is(ctx.res.b, 2)
|
t.is(ctx.res.b, 2)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('setAnsiColors', t => {
|
||||||
|
utils.setAnsiColors(ansiHTML)
|
||||||
|
})
|
||||||
|
|
||||||
test('waitFor', function * (t) {
|
test('waitFor', function * (t) {
|
||||||
let s = Date.now()
|
let s = Date.now()
|
||||||
yield utils.waitFor(100)
|
yield utils.waitFor(100)
|
||||||
@ -28,7 +33,7 @@ test('urlJoin', t => {
|
|||||||
test('promisifyRouteParams (array)', t => {
|
test('promisifyRouteParams (array)', t => {
|
||||||
const array = [1]
|
const array = [1]
|
||||||
const promise = utils.promisifyRouteParams(array)
|
const promise = utils.promisifyRouteParams(array)
|
||||||
t.true(promise instanceof Promise)
|
t.is(typeof promise, 'object')
|
||||||
return promise
|
return promise
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
t.is(res, array)
|
t.is(res, array)
|
||||||
@ -41,7 +46,7 @@ test('promisifyRouteParams (fn => array)', t => {
|
|||||||
return array
|
return array
|
||||||
}
|
}
|
||||||
const promise = utils.promisifyRouteParams(fn)
|
const promise = utils.promisifyRouteParams(fn)
|
||||||
t.true(promise instanceof Promise)
|
t.is(typeof promise, 'object')
|
||||||
return promise
|
return promise
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
t.is(res, array)
|
t.is(res, array)
|
||||||
@ -56,7 +61,7 @@ test('promisifyRouteParams (fn => promise)', t => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
const promise = utils.promisifyRouteParams(fn)
|
const promise = utils.promisifyRouteParams(fn)
|
||||||
t.true(promise instanceof Promise)
|
t.is(typeof promise, 'object')
|
||||||
return promise
|
return promise
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
t.is(res, array)
|
t.is(res, array)
|
||||||
@ -68,7 +73,7 @@ test('promisifyRouteParams (fn(cb) with error)', t => {
|
|||||||
cb('Error here')
|
cb('Error here')
|
||||||
}
|
}
|
||||||
const promise = utils.promisifyRouteParams(fn)
|
const promise = utils.promisifyRouteParams(fn)
|
||||||
t.true(promise instanceof Promise)
|
t.is(typeof promise, 'object')
|
||||||
return promise
|
return promise
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
t.is(e, 'Error here')
|
t.is(e, 'Error here')
|
||||||
@ -81,7 +86,7 @@ test('promisifyRouteParams (fn(cb) with result)', t => {
|
|||||||
cb(null, array)
|
cb(null, array)
|
||||||
}
|
}
|
||||||
const promise = utils.promisifyRouteParams(fn)
|
const promise = utils.promisifyRouteParams(fn)
|
||||||
t.true(promise instanceof Promise)
|
t.is(typeof promise, 'object')
|
||||||
return promise
|
return promise
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
t.is(res, array)
|
t.is(res, array)
|
||||||
|
Loading…
Reference in New Issue
Block a user