Get tests passing again

This commit is contained in:
Michael Jackson
2019-07-09 17:21:25 -07:00
parent 2e3c9ff526
commit f3ecddea47
42 changed files with 309 additions and 305 deletions

View File

@ -1,4 +1,4 @@
import createSearch from '../createSearch';
import createSearch from '../createSearch.js';
describe('createSearch', () => {
it('omits the trailing = for empty string values', () => {

View File

@ -1,4 +1,4 @@
import getContentType from '../getContentType';
import getContentType from '../getContentType.js';
it('gets a content type of text/plain for LICENSE|README|CHANGES|AUTHORS|Makefile', () => {
expect(getContentType('AUTHORS')).toBe('text/plain');

View File

@ -1,4 +1,4 @@
import parsePackageURL from '../parsePackageURL';
import parsePackageURL from '../parsePackageURL.js';
describe('parsePackageURL', () => {
it('parses plain packages', () => {

View File

@ -1,10 +1,10 @@
export default function bufferStream(stream) {
return new Promise((resolve, reject) => {
return new Promise((accept, reject) => {
const chunks = [];
stream
.on('error', reject)
.on('data', chunk => chunks.push(chunk))
.on('end', () => resolve(Buffer.concat(chunks)));
.on('end', () => accept(Buffer.concat(chunks)));
});
}

View File

@ -1,7 +0,0 @@
import express from 'express';
export default function createRouter(configureRouter) {
const router = express.Router();
configureRouter(router);
return router;
}

View File

@ -3,9 +3,7 @@ export default function createSearch(query) {
const params = keys.reduce(
(memo, key) =>
memo.concat(
query[key] === ''
? key // Omit the trailing "=" from key=
: `${key}=${encodeURIComponent(query[key])}`
query[key] ? `${key}=${encodeURIComponent(query[key])}` : key
),
[]
);

View File

@ -4,8 +4,8 @@ import gunzip from 'gunzip-maybe';
import tar from 'tar-stream';
import LRUCache from 'lru-cache';
import debug from './debug';
import bufferStream from './bufferStream';
import debug from './debug.js';
import bufferStream from './bufferStream.js';
const npmRegistryURL =
process.env.NPM_REGISTRY_URL || 'https://registry.npmjs.org';

View File

@ -1,6 +1,6 @@
import babel from '@babel/core';
import unpkgRewrite from '../plugins/unpkgRewrite';
import unpkgRewrite from '../plugins/unpkgRewrite.js';
const origin = process.env.ORIGIN || 'https://unpkg.com';