Use single quotes :P
This commit is contained in:
@ -1,15 +1,15 @@
|
||||
const createSearch = require("../createSearch");
|
||||
const createSearch = require('../createSearch');
|
||||
|
||||
describe("createSearch", () => {
|
||||
it("omits the trailing = for empty string values", () => {
|
||||
expect(createSearch({ a: "a", b: "" })).toEqual("?a=a&b");
|
||||
describe('createSearch', () => {
|
||||
it('omits the trailing = for empty string values', () => {
|
||||
expect(createSearch({ a: 'a', b: '' })).toEqual('?a=a&b');
|
||||
});
|
||||
|
||||
it("sorts keys", () => {
|
||||
expect(createSearch({ b: "b", a: "a", c: "c" })).toEqual("?a=a&b=b&c=c");
|
||||
it('sorts keys', () => {
|
||||
expect(createSearch({ b: 'b', a: 'a', c: 'c' })).toEqual('?a=a&b=b&c=c');
|
||||
});
|
||||
|
||||
it("returns an empty string when there are no params", () => {
|
||||
expect(createSearch({})).toEqual("");
|
||||
it('returns an empty string when there are no params', () => {
|
||||
expect(createSearch({})).toEqual('');
|
||||
});
|
||||
});
|
||||
|
@ -1,39 +1,39 @@
|
||||
const getContentType = require("../getContentType");
|
||||
const getContentType = require('../getContentType');
|
||||
|
||||
it("gets a content type of text/plain for LICENSE|README|CHANGES|AUTHORS|Makefile", () => {
|
||||
expect(getContentType("AUTHORS")).toBe("text/plain");
|
||||
expect(getContentType("CHANGES")).toBe("text/plain");
|
||||
expect(getContentType("LICENSE")).toBe("text/plain");
|
||||
expect(getContentType("Makefile")).toBe("text/plain");
|
||||
expect(getContentType("PATENTS")).toBe("text/plain");
|
||||
expect(getContentType("README")).toBe("text/plain");
|
||||
it('gets a content type of text/plain for LICENSE|README|CHANGES|AUTHORS|Makefile', () => {
|
||||
expect(getContentType('AUTHORS')).toBe('text/plain');
|
||||
expect(getContentType('CHANGES')).toBe('text/plain');
|
||||
expect(getContentType('LICENSE')).toBe('text/plain');
|
||||
expect(getContentType('Makefile')).toBe('text/plain');
|
||||
expect(getContentType('PATENTS')).toBe('text/plain');
|
||||
expect(getContentType('README')).toBe('text/plain');
|
||||
});
|
||||
|
||||
it("gets a content type of text/plain for .*rc files", () => {
|
||||
expect(getContentType(".eslintrc")).toBe("text/plain");
|
||||
expect(getContentType(".babelrc")).toBe("text/plain");
|
||||
expect(getContentType(".anythingrc")).toBe("text/plain");
|
||||
it('gets a content type of text/plain for .*rc files', () => {
|
||||
expect(getContentType('.eslintrc')).toBe('text/plain');
|
||||
expect(getContentType('.babelrc')).toBe('text/plain');
|
||||
expect(getContentType('.anythingrc')).toBe('text/plain');
|
||||
});
|
||||
|
||||
it("gets a content type of text/plain for .git* files", () => {
|
||||
expect(getContentType(".gitignore")).toBe("text/plain");
|
||||
expect(getContentType(".gitanything")).toBe("text/plain");
|
||||
it('gets a content type of text/plain for .git* files', () => {
|
||||
expect(getContentType('.gitignore')).toBe('text/plain');
|
||||
expect(getContentType('.gitanything')).toBe('text/plain');
|
||||
});
|
||||
|
||||
it("gets a content type of text/plain for .*ignore files", () => {
|
||||
expect(getContentType(".eslintignore")).toBe("text/plain");
|
||||
expect(getContentType(".anythingignore")).toBe("text/plain");
|
||||
it('gets a content type of text/plain for .*ignore files', () => {
|
||||
expect(getContentType('.eslintignore')).toBe('text/plain');
|
||||
expect(getContentType('.anythingignore')).toBe('text/plain');
|
||||
});
|
||||
|
||||
it("gets a content type of text/plain for .ts files", () => {
|
||||
expect(getContentType("app.ts")).toBe("text/plain");
|
||||
expect(getContentType("app.d.ts")).toBe("text/plain");
|
||||
it('gets a content type of text/plain for .ts files', () => {
|
||||
expect(getContentType('app.ts')).toBe('text/plain');
|
||||
expect(getContentType('app.d.ts')).toBe('text/plain');
|
||||
});
|
||||
|
||||
it("gets a content type of text/plain for .flow files", () => {
|
||||
expect(getContentType("app.js.flow")).toBe("text/plain");
|
||||
it('gets a content type of text/plain for .flow files', () => {
|
||||
expect(getContentType('app.js.flow')).toBe('text/plain');
|
||||
});
|
||||
|
||||
it("gets a content type of text/plain for .lock files", () => {
|
||||
expect(getContentType("yarn.lock")).toBe("text/plain");
|
||||
it('gets a content type of text/plain for .lock files', () => {
|
||||
expect(getContentType('yarn.lock')).toBe('text/plain');
|
||||
});
|
||||
|
@ -1,80 +1,80 @@
|
||||
const parsePackageURL = require("../parsePackageURL");
|
||||
const parsePackageURL = require('../parsePackageURL');
|
||||
|
||||
describe("parsePackageURL", () => {
|
||||
it("parses plain packages", () => {
|
||||
expect(parsePackageURL("/history@1.0.0/umd/history.min.js")).toEqual({
|
||||
pathname: "/history@1.0.0/umd/history.min.js",
|
||||
search: "",
|
||||
describe('parsePackageURL', () => {
|
||||
it('parses plain packages', () => {
|
||||
expect(parsePackageURL('/history@1.0.0/umd/history.min.js')).toEqual({
|
||||
pathname: '/history@1.0.0/umd/history.min.js',
|
||||
search: '',
|
||||
query: {},
|
||||
packageName: "history",
|
||||
packageVersion: "1.0.0",
|
||||
filename: "/umd/history.min.js"
|
||||
packageName: 'history',
|
||||
packageVersion: '1.0.0',
|
||||
filename: '/umd/history.min.js'
|
||||
});
|
||||
});
|
||||
|
||||
it("parses plain packages with a hyphen in the name", () => {
|
||||
expect(parsePackageURL("/query-string@5.0.0/index.js")).toEqual({
|
||||
pathname: "/query-string@5.0.0/index.js",
|
||||
search: "",
|
||||
it('parses plain packages with a hyphen in the name', () => {
|
||||
expect(parsePackageURL('/query-string@5.0.0/index.js')).toEqual({
|
||||
pathname: '/query-string@5.0.0/index.js',
|
||||
search: '',
|
||||
query: {},
|
||||
packageName: "query-string",
|
||||
packageVersion: "5.0.0",
|
||||
filename: "/index.js"
|
||||
packageName: 'query-string',
|
||||
packageVersion: '5.0.0',
|
||||
filename: '/index.js'
|
||||
});
|
||||
});
|
||||
|
||||
it("parses plain packages with no version specified", () => {
|
||||
expect(parsePackageURL("/query-string/index.js")).toEqual({
|
||||
pathname: "/query-string/index.js",
|
||||
search: "",
|
||||
it('parses plain packages with no version specified', () => {
|
||||
expect(parsePackageURL('/query-string/index.js')).toEqual({
|
||||
pathname: '/query-string/index.js',
|
||||
search: '',
|
||||
query: {},
|
||||
packageName: "query-string",
|
||||
packageVersion: "latest",
|
||||
filename: "/index.js"
|
||||
packageName: 'query-string',
|
||||
packageVersion: 'latest',
|
||||
filename: '/index.js'
|
||||
});
|
||||
});
|
||||
|
||||
it("parses plain packages with version spec", () => {
|
||||
expect(parsePackageURL("/query-string@>=4.0.0/index.js")).toEqual({
|
||||
pathname: "/query-string@>=4.0.0/index.js",
|
||||
search: "",
|
||||
it('parses plain packages with version spec', () => {
|
||||
expect(parsePackageURL('/query-string@>=4.0.0/index.js')).toEqual({
|
||||
pathname: '/query-string@>=4.0.0/index.js',
|
||||
search: '',
|
||||
query: {},
|
||||
packageName: "query-string",
|
||||
packageVersion: ">=4.0.0",
|
||||
filename: "/index.js"
|
||||
packageName: 'query-string',
|
||||
packageVersion: '>=4.0.0',
|
||||
filename: '/index.js'
|
||||
});
|
||||
});
|
||||
|
||||
it("parses scoped packages", () => {
|
||||
expect(parsePackageURL("/@angular/router@4.3.3/src/index.d.ts")).toEqual({
|
||||
pathname: "/@angular/router@4.3.3/src/index.d.ts",
|
||||
search: "",
|
||||
it('parses scoped packages', () => {
|
||||
expect(parsePackageURL('/@angular/router@4.3.3/src/index.d.ts')).toEqual({
|
||||
pathname: '/@angular/router@4.3.3/src/index.d.ts',
|
||||
search: '',
|
||||
query: {},
|
||||
packageName: "@angular/router",
|
||||
packageVersion: "4.3.3",
|
||||
filename: "/src/index.d.ts"
|
||||
packageName: '@angular/router',
|
||||
packageVersion: '4.3.3',
|
||||
filename: '/src/index.d.ts'
|
||||
});
|
||||
});
|
||||
|
||||
it("parses package names with a period in them", () => {
|
||||
expect(parsePackageURL("/index.js")).toEqual({
|
||||
pathname: "/index.js",
|
||||
search: "",
|
||||
it('parses package names with a period in them', () => {
|
||||
expect(parsePackageURL('/index.js')).toEqual({
|
||||
pathname: '/index.js',
|
||||
search: '',
|
||||
query: {},
|
||||
packageName: "index.js",
|
||||
packageVersion: "latest",
|
||||
filename: ""
|
||||
packageName: 'index.js',
|
||||
packageVersion: 'latest',
|
||||
filename: ''
|
||||
});
|
||||
});
|
||||
|
||||
it("parses valid query parameters", () => {
|
||||
expect(parsePackageURL("/history?main=browser")).toEqual({
|
||||
pathname: "/history",
|
||||
search: "?main=browser",
|
||||
query: { main: "browser" },
|
||||
packageName: "history",
|
||||
packageVersion: "latest",
|
||||
filename: ""
|
||||
it('parses valid query parameters', () => {
|
||||
expect(parsePackageURL('/history?main=browser')).toEqual({
|
||||
pathname: '/history',
|
||||
search: '?main=browser',
|
||||
query: { main: 'browser' },
|
||||
packageName: 'history',
|
||||
packageVersion: 'latest',
|
||||
filename: ''
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user