|
| 1 | +import { assertStatusCode } from "../../../helpers/assertionsHelper"; |
| 2 | +import { makeRequest } from "../../../helpers/makeRequest"; |
| 3 | + |
| 4 | +const BASE_URL = "https://rickandmortyapi.com/api/"; |
| 5 | + |
| 6 | +/** |
| 7 | + * Sanity Tests |
| 8 | + * @group sanity_tests |
| 9 | + */ |
| 10 | +describe("Rick and Morty API - Sanity Tests", () => { |
| 11 | + test("should respond with a 200 status for the characters endpoint", async () => { |
| 12 | + const response = await makeRequest("get", `${BASE_URL}/character`); |
| 13 | + assertStatusCode(response, 200); |
| 14 | + }); |
| 15 | + |
| 16 | + test("should respond with a 200 status for the episodes endpoint", async () => { |
| 17 | + const response = await makeRequest("get", `${BASE_URL}/episode`); |
| 18 | + assertStatusCode(response, 200); |
| 19 | + }); |
| 20 | + |
| 21 | + test("should respond with a 200 status for the locations endpoint", async () => { |
| 22 | + const response = await makeRequest("get", `${BASE_URL}/location`); |
| 23 | + assertStatusCode(response, 200); |
| 24 | + }); |
| 25 | + |
| 26 | + test("should respond with a 200 status for the specific character endpoint", async () => { |
| 27 | + const response = await makeRequest("get", `${BASE_URL}/character/1`); |
| 28 | + assertStatusCode(response, 200); |
| 29 | + }); |
| 30 | + |
| 31 | + test("should return 404 for non-existent endpoint", async () => { |
| 32 | + const response = await makeRequest("get", `${BASE_URL}/nonexisting`); |
| 33 | + assertStatusCode(response, 404); |
| 34 | + }); |
| 35 | +}); |
0 commit comments