-
Notifications
You must be signed in to change notification settings - Fork 496
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: properly configure prettier to minimize diff
- Loading branch information
Showing
28 changed files
with
2,282 additions
and
2,246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
service_name: travis-ci | ||
repo_token: vuiBI2GvUrtb2lU2yChUBCOPggEAxIdRs | ||
repo_token: vuiBI2GvUrtb2lU2yChUBCOPggEAxIdRs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); | ||
}); |
Oops, something went wrong.