Skip to content

Commit f3141eb

Browse files
committed
added error tests for all endpoints
1 parent f487cfa commit f3141eb

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

test/v1-all.test.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ test("It should return LC-39A info", () => {
7474
})
7575
})
7676

77+
test("It should return no launchpads found info", () => {
78+
return request(app).get("/v1/launchpads/ksc_lc_40a").then(response => {
79+
expect(response.statusCode).toBe(200)
80+
})
81+
})
82+
7783
// Past Launches Tests
7884
test("It should return all past launches", () => {
7985
return request(app).get("/v1/launches").then(response => {
@@ -93,24 +99,48 @@ test("It should return all 2012 launches", () => {
9399
})
94100
})
95101

102+
test("It should return no 2005 launches", () => {
103+
return request(app).get("/v1/launches?year=2005").then(response => {
104+
expect(response.statusCode).toBe(200)
105+
})
106+
})
107+
96108
test("It should return past launches in timeframe", () => {
97109
return request(app).get("/v1/launches?start=2011-01-20&final=2017-05-25").then(response => {
98110
expect(response.statusCode).toBe(200)
99111
})
100112
})
101113

114+
test("It should return no past launches in timeframe", () => {
115+
return request(app).get("/v1/launches?start=2005-01-20&final=2005-05-25").then(response => {
116+
expect(response.statusCode).toBe(200)
117+
})
118+
})
119+
102120
test("It should return all launches with core B1021", () => {
103121
return request(app).get("/v1/launches/cores/B1021").then(response => {
104122
expect(response.statusCode).toBe(200)
105123
})
106124
})
107125

126+
test("It should return no launches with core A1021", () => {
127+
return request(app).get("/v1/launches/cores/A1021").then(response => {
128+
expect(response.statusCode).toBe(200)
129+
})
130+
})
131+
108132
test("It should return all launches with cap C106", () => {
109133
return request(app).get("/v1/launches/caps/C106").then(response => {
110134
expect(response.statusCode).toBe(200)
111135
})
112136
})
113137

138+
test("It should return no launches with cap C403", () => {
139+
return request(app).get("/v1/launches/caps/C403").then(response => {
140+
expect(response.statusCode).toBe(200)
141+
})
142+
})
143+
114144
// Upcoming Launch Tests
115145
test("It should return all upcoming launches", () => {
116146
return request(app).get("/v1/launches/upcoming").then(response => {
@@ -124,12 +154,24 @@ test("It should return all upcoming launches in 2017", () => {
124154
})
125155
})
126156

157+
test("It should return no upcoming launches in 2016", () => {
158+
return request(app).get("/v1/launches/upcoming?year=2016").then(response => {
159+
expect(response.statusCode).toBe(200)
160+
})
161+
})
162+
127163
test("It should return all launches in the timeframe", () => {
128164
return request(app).get("/v1/launches/upcoming?start=2011-01-20&final=2017-05-25").then(response => {
129165
expect(response.statusCode).toBe(200)
130166
})
131167
})
132168

169+
test("It should return no launches in the timeframe", () => {
170+
return request(app).get("/v1/launches/upcoming?start=2011-01-20&final=2016-05-25").then(response => {
171+
expect(response.statusCode).toBe(200)
172+
})
173+
})
174+
133175
// Parts Tests
134176
test("It should return all capsule info", () => {
135177
return request(app).get("/v1/parts/caps").then(response => {
@@ -143,6 +185,12 @@ test("It should return all info on C106", () => {
143185
})
144186
})
145187

188+
test("It should return np info on C406", () => {
189+
return request(app).get("/v1/parts/caps/C406").then(response => {
190+
expect(response.statusCode).toBe(200)
191+
})
192+
})
193+
146194
test("It should return all core info", () => {
147195
return request(app).get("/v1/parts/cores").then(response => {
148196
expect(response.statusCode).toBe(200)
@@ -154,3 +202,9 @@ test("It should return core info on B1021", () => {
154202
expect(response.statusCode).toBe(200)
155203
})
156204
})
205+
206+
test("It should return no core info on A1021", () => {
207+
return request(app).get("/v1/parts/cores/A1021").then(response => {
208+
expect(response.statusCode).toBe(200)
209+
})
210+
})

0 commit comments

Comments
 (0)