Skip to content

Commit 93ae20f

Browse files
committed
Remove conditionals in test
1 parent 52070d8 commit 93ae20f

1 file changed

Lines changed: 23 additions & 25 deletions

File tree

packages/api/test/index.test.ts

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,8 @@ describe("GET /timeline", () => {
189189
end: "2025-12-18T00:00:00Z",
190190
});
191191

192-
if (response.body.station?.type === "subordinate") {
193-
expect(response.status).toBe(400);
194-
expect(response.body.message).toContain("subordinate");
195-
}
192+
expect(response.status).toBe(400);
193+
expect(response.body.message).toContain("subordinate");
196194
});
197195
});
198196

@@ -309,17 +307,17 @@ describe("GET /stations/:id/extremes", () => {
309307
(s: { type: string }) => s.type === "subordinate",
310308
);
311309

312-
if (subordinate) {
313-
const response = await request(app)
314-
.get(`/stations/${encodeURIComponent(subordinate.id)}/extremes`)
315-
.query({
316-
start: "2025-12-17T00:00:00Z",
317-
end: "2025-12-18T00:00:00Z",
318-
});
310+
expect(subordinate, "could not find subordinate station").toBeDefined();
319311

320-
expect(response.status).toBe(200);
321-
expect(response.body).toHaveProperty("extremes");
322-
}
312+
const response = await request(app)
313+
.get(`/stations/${encodeURIComponent(subordinate.id)}/extremes`)
314+
.query({
315+
start: "2025-12-17T00:00:00Z",
316+
end: "2025-12-18T00:00:00Z",
317+
});
318+
319+
expect(response.status).toBe(200);
320+
expect(response.body).toHaveProperty("extremes");
323321
});
324322

325323
test("returns 404 for non-existent station", async () => {
@@ -396,17 +394,17 @@ describe("GET /stations/:id/timeline", () => {
396394
(s: { type: string }) => s.type === "subordinate",
397395
);
398396

399-
if (subordinate) {
400-
const response = await request(app)
401-
.get(`/stations/${encodeURIComponent(subordinate.id)}/timeline`)
402-
.query({
403-
start: "2025-12-17T00:00:00Z",
404-
end: "2025-12-18T00:00:00Z",
405-
});
406-
407-
expect(response.status).toBe(400);
408-
expect(response.body.message).toContain("subordinate");
409-
}
397+
expect(subordinate, "could not find subordinate station").toBeDefined();
398+
399+
const response = await request(app)
400+
.get(`/stations/${encodeURIComponent(subordinate.id)}/timeline`)
401+
.query({
402+
start: "2025-12-17T00:00:00Z",
403+
end: "2025-12-18T00:00:00Z",
404+
});
405+
406+
expect(response.status).toBe(400);
407+
expect(response.body.message).toContain("subordinate");
410408
});
411409

412410
test("returns 404 for non-existent station", async () => {

0 commit comments

Comments
 (0)