Skip to content

Commit

Permalink
fix: properly configure prettier to minimize diff
Browse files Browse the repository at this point in the history
  • Loading branch information
eligundry committed Jul 26, 2023
1 parent cee94fd commit 13e68f5
Show file tree
Hide file tree
Showing 28 changed files with 2,282 additions and 2,246 deletions.
2 changes: 1 addition & 1 deletion .coveralls.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
service_name: travis-ci
repo_token: vuiBI2GvUrtb2lU2yChUBCOPggEAxIdRs
repo_token: vuiBI2GvUrtb2lU2yChUBCOPggEAxIdRs
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.md
18 changes: 9 additions & 9 deletions __tests__/authentication-request.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
var AuthenticationRequest = require("../src/authentication-request");
var AuthenticationRequest = require('../src/authentication-request');

describe("Create Authentication Requests", () => {
test("Should use default settings if none are supplied", () => {
describe('Create Authentication Requests', () => {
test('Should use default settings if none are supplied', () => {
var request = AuthenticationRequest.builder().build();

expect(request.getHost()).toBe("accounts.spotify.com");
expect(request.getHost()).toBe('accounts.spotify.com');
expect(request.getPort()).toBe(443);
expect(request.getScheme()).toBe("https");
expect(request.getScheme()).toBe('https');
expect(request.getHeaders()).toBeFalsy();
expect(request.getPath()).toBeFalsy();
expect(request.getQueryParameters()).toBeFalsy();
expect(request.getBodyParameters()).toBeFalsy();
});

test("Can overwrite one of the default parameters", () => {
test('Can overwrite one of the default parameters', () => {
var request = AuthenticationRequest.builder()
.withHost("such.host.wow")
.withHost('such.host.wow')
.build();

expect(request.getHost()).toBe("such.host.wow");
expect(request.getHost()).toBe('such.host.wow');
expect(request.getPort()).toBe(443);
expect(request.getScheme()).toBe("https");
expect(request.getScheme()).toBe('https');
expect(request.getHeaders()).toBeFalsy();
expect(request.getPath()).toBeFalsy();
expect(request.getQueryParameters()).toBeFalsy();
Expand Down
120 changes: 60 additions & 60 deletions __tests__/base-request.js
Original file line number Diff line number Diff line change
@@ -1,180 +1,180 @@
var Request = require("../src/base-request");
var Request = require('../src/base-request');

describe("Create Requests", () => {
test("Should create host, port, and scheme", () => {
describe('Create Requests', () => {
test('Should create host, port, and scheme', () => {
var request = Request.builder()
.withHost("such.api.wow")
.withHost('such.api.wow')
.withPort(1337)
.withScheme("http")
.withScheme('http')
.build();

expect(request.getHost()).toBe("such.api.wow");
expect(request.getHost()).toBe('such.api.wow');
expect(request.getPort()).toBe(1337);
expect(request.getScheme()).toBe("http");
expect(request.getScheme()).toBe('http');
});

test("Should add query parameters", () => {
test('Should add query parameters', () => {
var request = Request.builder()
.withHost("such.api.wow")
.withHost('such.api.wow')
.withPort(1337)
.withScheme("http")
.withScheme('http')
.withQueryParameters({
oneParameter: 1,
anotherParameter: true,
thirdParameter: "hello",
thirdParameter: 'hello'
})
.build();

expect(request.getQueryParameters().oneParameter).toBe(1);
expect(request.getQueryParameters().anotherParameter).toBe(true);
expect(request.getQueryParameters().thirdParameter).toBe("hello");
expect(request.getQueryParameters().thirdParameter).toBe('hello');
});

test("Should add query parameters (multiple calls)", () => {
test('Should add query parameters (multiple calls)', () => {
var request = Request.builder()
.withHost("such.api.wow")
.withHost('such.api.wow')
.withPort(1337)
.withScheme("http")
.withScheme('http')
.withQueryParameters({
oneParameter: 1,
anotherParameter: true,
anotherParameter: true
})
.withQueryParameters({
thirdParameter: "hello",
thirdParameter: 'hello'
})
.build();

expect(request.getQueryParameters().oneParameter).toBe(1);
expect(request.getQueryParameters().anotherParameter).toBe(true);
expect(request.getQueryParameters().thirdParameter).toBe("hello");
expect(request.getQueryParameters().thirdParameter).toBe('hello');
});

test("Should add query parameters (combine calls)", () => {
test('Should add query parameters (combine calls)', () => {
var request = Request.builder()
.withHost("such.api.wow")
.withHost('such.api.wow')
.withPort(1337)
.withScheme("http")
.withScheme('http')
.withQueryParameters(
{
oneParameter: 1,
anotherParameter: true,
anotherParameter: true
},
{
thirdParameter: "hello",
thirdParameter: 'hello'
}
)
.build();

expect(request.getQueryParameters().oneParameter).toBe(1);
expect(request.getQueryParameters().anotherParameter).toBe(true);
expect(request.getQueryParameters().thirdParameter).toBe("hello");
expect(request.getQueryParameters().thirdParameter).toBe('hello');
});

test("Should add body parameters", () => {
test('Should add body parameters', () => {
var request = Request.builder()
.withHost("such.api.wow")
.withHost('such.api.wow')
.withPort(1337)
.withScheme("http")
.withScheme('http')
.withBodyParameters({
one: 1,
two: true,
three: "world",
three: 'world'
})
.build();

expect(request.getBodyParameters().one).toBe(1);
expect(request.getBodyParameters().two).toBe(true);
expect(request.getBodyParameters().three).toBe("world");
expect(request.getBodyParameters().three).toBe('world');
});

test("Should add array to body parameters", () => {
test('Should add array to body parameters', () => {
var request = Request.builder()
.withHost("such.api.wow")
.withHost('such.api.wow')
.withPort(1337)
.withScheme("http")
.withBodyParameters(["3VNWq8rTnQG6fM1eldSpZ0"])
.withScheme('http')
.withBodyParameters(['3VNWq8rTnQG6fM1eldSpZ0'])
.build();

expect(request.getBodyParameters()).toEqual(["3VNWq8rTnQG6fM1eldSpZ0"]);
expect(request.getBodyParameters()).toEqual(['3VNWq8rTnQG6fM1eldSpZ0']);
});

test("Should add header parameters", () => {
test('Should add header parameters', () => {
var request = Request.builder()
.withHost("such.api.wow")
.withHost('such.api.wow')
.withPort(1337)
.withScheme("http")
.withScheme('http')
.withHeaders({
Authorization: "Basic WOOP",
"Content-Type": "application/lol",
Authorization: 'Basic WOOP',
'Content-Type': 'application/lol'
})
.build();

expect(request.getHeaders().Authorization).toBe("Basic WOOP");
expect(request.getHeaders()["Content-Type"]).toBe("application/lol");
expect(request.getHeaders().Authorization).toBe('Basic WOOP');
expect(request.getHeaders()['Content-Type']).toBe('application/lol');
});

test("Should add path", () => {
test('Should add path', () => {
var request = Request.builder()
.withHost("such.api.wow")
.withHost('such.api.wow')
.withPort(1337)
.withPath("/v1/users/meriosweg")
.withPath('/v1/users/meriosweg')
.build();

expect(request.getPath()).toBe("/v1/users/meriosweg");
expect(request.getPath()).toBe('/v1/users/meriosweg');
});

test("Should build URI", () => {
test('Should build URI', () => {
var request = Request.builder()
.withHost("such.api.wow")
.withScheme("https")
.withHost('such.api.wow')
.withScheme('https')
.withPort(1337)
.withPath("/v1/users/meriosweg")
.withPath('/v1/users/meriosweg')
.build();

expect(request.getURI()).toBe(
"https://such.api.wow:1337/v1/users/meriosweg"
'https://such.api.wow:1337/v1/users/meriosweg'
);
});

test("Should construct empty query paramaters string", () => {
test('Should construct empty query paramaters string', () => {
var request = Request.builder().withQueryParameters({}).build();

expect(request.getQueryParameterString()).toBeFalsy();
});

test("Should construct query paramaters string for one parameter", () => {
test('Should construct query paramaters string for one parameter', () => {
var request = Request.builder()
.withQueryParameters({
one: 1,
one: 1
})
.build();

expect(request.getQueryParameterString()).toBe("?one=1");
expect(request.getQueryParameterString()).toBe('?one=1');
});

test("Should construct query paramaters string for multiple parameters", () => {
test('Should construct query paramaters string for multiple parameters', () => {
var request = Request.builder()
.withQueryParameters({
one: 1,
two: true,
three: "world",
three: 'world'
})
.build();

expect(request.getQueryParameterString()).toBe(
"?one=1&two=true&three=world"
'?one=1&two=true&three=world'
);
});

test("Should construct query paramaters string and exclude undefined values", () => {
test('Should construct query paramaters string and exclude undefined values', () => {
var request = Request.builder()
.withQueryParameters({
one: 1,
two: undefined,
three: "world",
three: 'world'
})
.build();

expect(request.getQueryParameterString()).toBe("?one=1&three=world");
expect(request.getQueryParameterString()).toBe('?one=1&three=world');
});
});
Loading

0 comments on commit 13e68f5

Please sign in to comment.