Get tests passing again
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import createSearch from '../createSearch';
|
||||
import createSearch from '../createSearch.js';
|
||||
|
||||
describe('createSearch', () => {
|
||||
it('omits the trailing = for empty string values', () => {
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import parsePackageURL from '../parsePackageURL';
|
||||
import parsePackageURL from '../parsePackageURL.js';
|
||||
|
||||
describe('parsePackageURL', () => {
|
||||
it('parses plain packages', () => {
|
||||
|
||||
@ -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)));
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
import express from 'express';
|
||||
|
||||
export default function createRouter(configureRouter) {
|
||||
const router = express.Router();
|
||||
configureRouter(router);
|
||||
return router;
|
||||
}
|
||||
@ -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
|
||||
),
|
||||
[]
|
||||
);
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user