style: use es6 in tests

This commit is contained in:
Stephan Bönnemann
2015-06-12 13:24:44 -07:00
parent 191ae78a9f
commit 889f5f4360
14 changed files with 132 additions and 176 deletions
+11 -13
View File
@@ -1,13 +1,11 @@
'use strict'
const test = require('tap').test
const nock = require('nock')
var test = require('tap').test
var nock = require('nock')
const npmInfo = require('../../dist/lib/npm-info.js')
var npmInfo = require('../../dist/lib/npm-info.js')
const registry = 'http://registry.npmjs.org/'
var registry = 'http://registry.npmjs.org/'
var defaultModule = {
const defaultModule = {
'dist-tags': {
latest: '1.0.0'
},
@@ -20,8 +18,8 @@ var defaultModule = {
process.env.npm_config_registry = registry
test('npm-info', function (t) {
var regMock = nock(registry, {
test('npm-info', (t) => {
const regMock = nock(registry, {
reqheaders: {
'authorization': 'Bearer testtoken'
}
@@ -31,17 +29,17 @@ test('npm-info', function (t) {
.get('/@user%2Fmodule')
.reply(200, defaultModule)
t.test('get unscoped module', function (t) {
t.test('get unscoped module', (t) => {
t.plan(3)
npmInfo('express', function (err, info) {
npmInfo('express', (err, info) => {
t.error(err, 'error')
t.is(info.version, '1.0.0', 'version')
t.is(info.gitHead, 'HEAD', 'gitHead')
})
})
t.test('get scoped module', function (t) {
t.test('get scoped module', (t) => {
t.plan(3)
npmInfo('@user/module', function (err, info) {
npmInfo('@user/module', (err, info) => {
t.error(err, 'error')
t.is(info.version, '1.0.0', 'version')
t.is(info.gitHead, 'HEAD', 'gitHead')