Skip to content

Commit 83a34df

Browse files
committed
added comprehensive matching to all tests for accuracy
1 parent 0c319da commit 83a34df

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

test/v1-all.test.js

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,74 +36,89 @@ test("It should return company info", () => {
3636
test("It should return all vehicle info", () => {
3737
return request(app).get("/v1/vehicles").then(response => {
3838
expect(response.statusCode).toBe(200)
39+
expect(response.text).toContain("Falcon 1")
40+
expect(response.text).toContain("Falcon 9")
41+
expect(response.text).toContain("Falcon Heavy")
42+
expect(response.text).toContain("Dragon")
3943
})
4044
})
4145

4246
test("It should return Falcon 1 info", () => {
4347
return request(app).get("/v1/vehicles/falcon1").then(response => {
4448
expect(response.statusCode).toBe(200)
49+
expect(response.text).toContain("Falcon 1")
4550
})
4651
})
4752

4853
test("It should return Falcon 9 info", () => {
4954
return request(app).get("/v1/vehicles/falcon9").then(response => {
5055
expect(response.statusCode).toBe(200)
56+
expect(response.text).toContain("Falcon 9")
5157
})
5258
})
5359

5460
test("It should return Falcon Heavy info", () => {
5561
return request(app).get("/v1/vehicles/falconheavy").then(response => {
5662
expect(response.statusCode).toBe(200)
63+
expect(response.text).toContain("Falcon Heavy")
5764
})
5865
})
5966

6067
test("It should return Dragon info", () => {
6168
return request(app).get("/v1/vehicles/dragon").then(response => {
6269
expect(response.statusCode).toBe(200)
70+
expect(response.text).toContain("Dragon")
6371
})
6472
})
6573

6674
// Launchpad Tests
6775
test("It should return all launchpads", () => {
6876
return request(app).get("/v1/launchpads").then(response => {
6977
expect(response.statusCode).toBe(200)
78+
expect(response.text.length).toBe(4368)
7079
})
7180
})
7281

7382
test("It should return LC-39A info", () => {
7483
return request(app).get("/v1/launchpads/ksc_lc_39a").then(response => {
7584
expect(response.statusCode).toBe(200)
85+
expect(response.text).toContain("ksc_lc_39a")
7686
})
7787
})
7888

7989
test("It should return no launchpads found info", () => {
8090
return request(app).get("/v1/launchpads/ksc_lc_40a").then(response => {
8191
expect(response.statusCode).toBe(200)
92+
expect(response.text).toContain("No Matches Found")
8293
})
8394
})
8495

8596
// Past Launches Tests
8697
test("It should return all past launches", () => {
8798
return request(app).get("/v1/launches").then(response => {
8899
expect(response.statusCode).toBe(200)
100+
expect(response.text.length).toBeGreaterThan(70000)
89101
})
90102
})
91103

92104
test("It should return the latest launch", () => {
93105
return request(app).get("/v1/launches/latest").then(response => {
94106
expect(response.statusCode).toBe(200)
107+
expect(response.text.length).toBeGreaterThan(0)
95108
})
96109
})
97110

98111
test("It should return all 2012 launches", () => {
99112
return request(app).get("/v1/launches?year=2012").then(response => {
100113
expect(response.statusCode).toBe(200)
114+
expect(response.text).toContain("2012")
101115
})
102116
})
103117

104118
test("It should return no 2005 launches", () => {
105119
return request(app).get("/v1/launches?year=2005").then(response => {
106120
expect(response.statusCode).toBe(200)
121+
expect(response.text).toContain("No Matches Found")
107122
})
108123
})
109124

@@ -116,30 +131,35 @@ test("It should return past launches in timeframe", () => {
116131
test("It should return no past launches in timeframe", () => {
117132
return request(app).get("/v1/launches?start=2005-01-20&final=2005-05-25").then(response => {
118133
expect(response.statusCode).toBe(200)
134+
expect(response.text).toContain("No Matches Found")
119135
})
120136
})
121137

122138
test("It should return all launches with core B1021", () => {
123139
return request(app).get("/v1/launches/cores/B1021").then(response => {
124140
expect(response.statusCode).toBe(200)
141+
expect(response.text).toContain("B1021")
125142
})
126143
})
127144

128145
test("It should return no launches with core A1021", () => {
129146
return request(app).get("/v1/launches/cores/A1021").then(response => {
130147
expect(response.statusCode).toBe(200)
148+
expect(response.text).toContain("No Matches Found")
131149
})
132150
})
133151

134152
test("It should return all launches with cap C106", () => {
135153
return request(app).get("/v1/launches/caps/C106").then(response => {
136154
expect(response.statusCode).toBe(200)
155+
expect(response.text).toContain("C106")
137156
})
138157
})
139158

140159
test("It should return no launches with cap C403", () => {
141160
return request(app).get("/v1/launches/caps/C403").then(response => {
142161
expect(response.statusCode).toBe(200)
162+
expect(response.text).toContain("No Matches Found")
143163
})
144164
})
145165

@@ -159,6 +179,7 @@ test("It should return all upcoming launches in 2017", () => {
159179
test("It should return no upcoming launches in 2016", () => {
160180
return request(app).get("/v1/launches/upcoming?year=2016").then(response => {
161181
expect(response.statusCode).toBe(200)
182+
expect(response.text).toContain("No Matches Found")
162183
})
163184
})
164185

@@ -171,42 +192,51 @@ test("It should return all launches in the timeframe", () => {
171192
test("It should return no launches in the timeframe", () => {
172193
return request(app).get("/v1/launches/upcoming?start=2011-01-20&final=2016-05-25").then(response => {
173194
expect(response.statusCode).toBe(200)
195+
expect(response.text).toContain("No Matches Found")
174196
})
175197
})
176198

177199
// Parts Tests
178200
test("It should return all capsule info", () => {
179201
return request(app).get("/v1/parts/caps").then(response => {
180202
expect(response.statusCode).toBe(200)
203+
expect(response.text).toContain("C101")
204+
expect(response.text).toContain("C113")
181205
})
182206
})
183207

184208
test("It should return all info on C106", () => {
185209
return request(app).get("/v1/parts/caps/C106").then(response => {
186210
expect(response.statusCode).toBe(200)
211+
expect(response.text).toContain("C106")
187212
})
188213
})
189214

190-
test("It should return np info on C406", () => {
215+
test("It should return no info on C406", () => {
191216
return request(app).get("/v1/parts/caps/C406").then(response => {
192217
expect(response.statusCode).toBe(200)
218+
expect(response.text).toContain("No Matches Found")
193219
})
194220
})
195221

196222
test("It should return all core info", () => {
197223
return request(app).get("/v1/parts/cores").then(response => {
198224
expect(response.statusCode).toBe(200)
225+
expect(response.text).toContain("B0003")
226+
expect(response.text).toContain("B1040")
199227
})
200228
})
201229

202230
test("It should return core info on B1021", () => {
203231
return request(app).get("/v1/parts/cores/B1021").then(response => {
204232
expect(response.statusCode).toBe(200)
233+
expect(response.text).toContain("B1021")
205234
})
206235
})
207236

208237
test("It should return no core info on A1021", () => {
209238
return request(app).get("/v1/parts/cores/A1021").then(response => {
210239
expect(response.statusCode).toBe(200)
240+
expect(response.text).toContain("No Matches Found")
211241
})
212242
})

0 commit comments

Comments
 (0)