Skip to content

Commit 7a2149d

Browse files
committed
Autofix test lint errors
1 parent c3b29ce commit 7a2149d

File tree

8 files changed

+159
-163
lines changed

8 files changed

+159
-163
lines changed

test/execute-baseurl.js

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {execute, buildRequest, baseUrl, applySecurities, self as stubs} from '..
66
// One can use operationId or pathItem + method
77

88
describe('baseUrl', () => {
9-
109
it('should calculate a valid baseUrl given host, basePath, context, schemes', () => {
1110
const res = baseUrl({
1211
spec: {
@@ -48,19 +47,19 @@ describe('baseUrl', () => {
4847
spec: {
4948
basePath: '/bar'
5049
},
51-
contextUrl: "http://example.com:9090/hello/swagger.json"
50+
contextUrl: 'http://example.com:9090/hello/swagger.json'
5251
})
5352

54-
expect(res).toEqual("http://example.com:9090/bar")
53+
expect(res).toEqual('http://example.com:9090/bar')
5554
})
5655

5756
it('should infer the entire url based on the contextUrl', () => {
5857
const res = baseUrl({
5958
spec: {},
60-
contextUrl: "http://example.com:9090/hello/swagger.json"
59+
contextUrl: 'http://example.com:9090/hello/swagger.json'
6160
})
6261

63-
expect(res).toEqual("http://example.com:9090")
62+
expect(res).toEqual('http://example.com:9090')
6463
})
6564

6665
it('should infer the host based on the contextUrl', () => {
@@ -69,10 +68,10 @@ describe('baseUrl', () => {
6968
schemes: ['https'],
7069
basePath: '/bar'
7170
},
72-
contextUrl: "http://example.com:9090/hello/swagger.json"
71+
contextUrl: 'http://example.com:9090/hello/swagger.json'
7372
})
7473

75-
expect(res).toEqual("https://example.com:9090/bar")
74+
expect(res).toEqual('https://example.com:9090/bar')
7675
})
7776

7877
it('should default to an empty basePath', () => {
@@ -81,53 +80,53 @@ describe('baseUrl', () => {
8180
schemes: ['https'],
8281
host: 'foo.com:8080'
8382
},
84-
contextUrl: "http://example.com:9090/hello/swagger.json"
83+
contextUrl: 'http://example.com:9090/hello/swagger.json'
8584
})
8685

87-
expect(res).toEqual("https://foo.com:8080")
86+
expect(res).toEqual('https://foo.com:8080')
8887
})
8988

9089
it('should default to the correct scheme based on the spec', () => {
9190
const res = baseUrl({
9291
spec: {
9392
schemes: ['https']
9493
},
95-
contextUrl: "http://example.com:9090/hello/swagger.json"
94+
contextUrl: 'http://example.com:9090/hello/swagger.json'
9695
})
9796

98-
expect(res).toEqual("https://example.com:9090")
97+
expect(res).toEqual('https://example.com:9090')
9998
})
10099

101100
it('should default to HTTP scheme based on the contextUrl', () => {
102101
const res = baseUrl({
103102
spec: {
104103
host: 'foo.com:8080'
105104
},
106-
contextUrl: "http://example.com:9090/hello/swagger.json"
105+
contextUrl: 'http://example.com:9090/hello/swagger.json'
107106
})
108107

109-
expect(res).toEqual("http://foo.com:8080")
108+
expect(res).toEqual('http://foo.com:8080')
110109
})
111110

112111
it('should default to HTTPS scheme based on the contextUrl', () => {
113112
const res = baseUrl({
114113
spec: {
115114
host: 'foo.com:8080'
116115
},
117-
contextUrl: "https://example.com:9090/hello/swagger.json"
116+
contextUrl: 'https://example.com:9090/hello/swagger.json'
118117
})
119118

120-
expect(res).toEqual("https://foo.com:8080")
119+
expect(res).toEqual('https://foo.com:8080')
121120
})
122121

123122
it('should default to HTTPS scheme and host based on the contextUrl', () => {
124123
const res = baseUrl({
125124
spec: {
126125
title: 'a spec'
127126
},
128-
contextUrl: "https://example.com:9090/hello/swagger.json"
127+
contextUrl: 'https://example.com:9090/hello/swagger.json'
129128
})
130129

131-
expect(res).toEqual("https://example.com:9090")
130+
expect(res).toEqual('https://example.com:9090')
132131
})
133132
})

test/execute.js

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ describe('execute', () => {
519519
'/one': {
520520
post: {
521521
operationId: 'postMe',
522-
parameters: [{name: 'foo', type: 'file', 'in': "formData"}]
522+
parameters: [{name: 'foo', type: 'file', in: 'formData'}]
523523
}
524524
}
525525
}
@@ -529,16 +529,15 @@ describe('execute', () => {
529529
const req = buildRequest({
530530
spec,
531531
operationId: 'postMe',
532-
parameters: { file: 'test'}})
532+
parameters: {file: 'test'}})
533533

534534
// Then
535535
expect(req.headers).toEqual({
536-
"content-type": "multipart/form-data"
536+
'content-type': 'multipart/form-data'
537537
})
538538

539539
expect(req.url).toEqual('http://swagger.io/one')
540540
expect(req.body).toBeA(FormData) // Would like to do a more thourough test ( ie: ensure the value `foo` exists.. but I don't feel like attacking the interals of the node pollyfill for FormData, as it seems to be missing `.get()`)
541-
542541
})
543542

544543
it('should add content-type application/x-www-form-urlencoded when in: formData ', function () {
@@ -559,15 +558,15 @@ describe('execute', () => {
559558
const req = buildRequest({
560559
spec,
561560
operationId: 'postMe',
562-
parameters: { file: 'test'}})
561+
parameters: {file: 'test'}})
563562

564563
// Then
565564
expect(req).toEqual({
566-
body: "file=test",
567-
method: "POST",
565+
body: 'file=test',
566+
method: 'POST',
568567
url: 'http://swagger.io/one',
569568
headers: {
570-
"content-type": "application/x-www-form-urlencoded"
569+
'content-type': 'application/x-www-form-urlencoded'
571570
},
572571
credentials: 'same-origin'
573572
})
@@ -577,7 +576,7 @@ describe('execute', () => {
577576
// Given
578577
const spec = {
579578
host: 'swagger.io',
580-
consumes: ["test"],
579+
consumes: ['test'],
581580
paths: {
582581
'/one': {
583582
post: {
@@ -592,15 +591,15 @@ describe('execute', () => {
592591
const req = buildRequest({
593592
spec,
594593
operationId: 'postMe',
595-
parameters: { file: 'test'}})
594+
parameters: {file: 'test'}})
596595

597596
// Then
598597
expect(req).toEqual({
599-
body: "file=test",
600-
method: "POST",
598+
body: 'file=test',
599+
method: 'POST',
601600
url: 'http://swagger.io/one',
602601
headers: {
603-
"content-type": "test"
602+
'content-type': 'test'
604603
},
605604
credentials: 'same-origin'
606605
})
@@ -610,12 +609,12 @@ describe('execute', () => {
610609
// Given
611610
const spec = {
612611
host: 'swagger.io',
613-
consumes: ["no"],
612+
consumes: ['no'],
614613
paths: {
615614
'/one': {
616615
post: {
617616
operationId: 'postMe',
618-
consumes: ["test"],
617+
consumes: ['test'],
619618
parameters: [{name: 'file', in: 'formData'}]
620619
}
621620
}
@@ -626,15 +625,15 @@ describe('execute', () => {
626625
const req = buildRequest({
627626
spec,
628627
operationId: 'postMe',
629-
parameters: { file: 'test'}})
628+
parameters: {file: 'test'}})
630629

631630
// Then
632631
expect(req).toEqual({
633-
body: "file=test",
634-
method: "POST",
632+
body: 'file=test',
633+
method: 'POST',
635634
url: 'http://swagger.io/one',
636635
headers: {
637-
"content-type": "test"
636+
'content-type': 'test'
638637
},
639638
credentials: 'same-origin'
640639
})
@@ -1585,10 +1584,10 @@ describe('execute', () => {
15851584
const req = buildRequest({spec, operationId: 'getPetsById', parameters: {id: 123, test: 567}})
15861585

15871586
expect(req).toEqual({
1588-
url: "http://swagger.io/v1/pet/123?test=567",
1587+
url: 'http://swagger.io/v1/pet/123?test=567',
15891588
headers: {},
15901589
credentials: 'same-origin',
1591-
method: "GET"
1590+
method: 'GET'
15921591
})
15931592
})
15941593

@@ -1620,13 +1619,13 @@ describe('execute', () => {
16201619
}
16211620
}
16221621

1623-
const req = buildRequest({ spec, operationId: 'getPetsById', parameters: { id: 123, test: 567 } })
1622+
const req = buildRequest({spec, operationId: 'getPetsById', parameters: {id: 123, test: 567}})
16241623

16251624
expect(req).toEqual({
1626-
url: "http://swagger.io/v1/pet/123?test=567",
1625+
url: 'http://swagger.io/v1/pet/123?test=567',
16271626
headers: {},
16281627
credentials: 'same-origin',
1629-
method: "GET"
1628+
method: 'GET'
16301629
})
16311630
})
16321631

test/http.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -311,28 +311,28 @@ describe('http', () => {
311311
})
312312

313313
describe('shouldDownloadAsText', () => {
314-
it('should return true for json, xml, yaml, and text types', function() {
314+
it('should return true for json, xml, yaml, and text types', function () {
315315
const types = [
316-
"text/x-yaml", "application/xml", "text/xml", "application/json",
317-
"text/plain"
316+
'text/x-yaml', 'application/xml', 'text/xml', 'application/json',
317+
'text/plain'
318318
]
319319

320-
types.forEach(v => {
321-
expect(`${v} ${shouldDownloadAsText(v)}`).toEqual(v + " true")
320+
types.forEach((v) => {
321+
expect(`${v} ${shouldDownloadAsText(v)}`).toEqual(`${v} true`)
322322
})
323323
})
324324

325-
it('should return false for other common types', function() {
325+
it('should return false for other common types', function () {
326326
const types = [
327-
"application/octet-stream", "application/x-binary"
327+
'application/octet-stream', 'application/x-binary'
328328
]
329329

330-
types.forEach(v => {
331-
expect(`${v} ${shouldDownloadAsText(v)}`).toEqual(v + " false")
330+
types.forEach((v) => {
331+
expect(`${v} ${shouldDownloadAsText(v)}`).toEqual(`${v} false`)
332332
})
333333
})
334334

335-
it('should fail gracefully when called with no parameters', function() {
335+
it('should fail gracefully when called with no parameters', function () {
336336
expect(shouldDownloadAsText()).toEqual(false)
337337
})
338338
})

test/interfaces.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ describe('intefaces', function () {
314314
// Then
315315
expect(tags).toEqual({
316316
alpha: {
317-
'get_one': null,
317+
get_one: null,
318318
}
319319
})
320320
})

test/resolver.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ describe('resolver', () => {
4848
it('should be able to resolve circular $refs when a baseDoc is provided', () => {
4949
// Given
5050
const spec = {
51-
"one": {
52-
"$ref": "#/two"
51+
one: {
52+
$ref: '#/two'
5353
},
54-
"two": {
55-
"a": {
56-
"$ref": "#/three"
54+
two: {
55+
a: {
56+
$ref: '#/three'
5757
}
5858
},
59-
"three": {
60-
"b": {
61-
"$ref": "#/two"
59+
three: {
60+
b: {
61+
$ref: '#/two'
6262
}
6363
}
6464
}
@@ -71,22 +71,22 @@ describe('resolver', () => {
7171
function handleResponse(obj) {
7272
expect(obj.errors).toEqual([])
7373
expect(obj.spec).toEqual({
74-
"one": {
75-
"a": {
76-
"b": {
77-
"$ref": "#/two"
74+
one: {
75+
a: {
76+
b: {
77+
$ref: '#/two'
7878
}
7979
}
8080
},
81-
"three": {
82-
"b": {
83-
"$ref": "#/two"
81+
three: {
82+
b: {
83+
$ref: '#/two'
8484
}
8585
},
86-
"two": {
87-
"a": {
88-
"b": {
89-
"$ref": "#/two"
86+
two: {
87+
a: {
88+
b: {
89+
$ref: '#/two'
9090
}
9191
}
9292
}

test/specmap/all-of.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ describe('allOf', function () {
174174
})
175175
})
176176

177-
it('merges arrays inside of an `allOf`', function() {
177+
it('merges arrays inside of an `allOf`', function () {
178178
return mapSpec({
179179
plugins: [plugins.refs, plugins.allOf],
180180
showDebug: true,

0 commit comments

Comments
 (0)