-
Notifications
You must be signed in to change notification settings - Fork 375
/
Copy pathrequests.test.js
52 lines (45 loc) · 1.17 KB
/
requests.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const axios = require("axios");
const { index } = require("../src/requests");
const BASE_URL = "http://localhost:5000";
describe("requests.js", () => {
describe("index()", () => {
const data = [
{
id: "HwLvy2S",
name: "Ursa Minor",
meaning: "Little Bear",
starsWithPlanets: 6,
quadrant: "NQ3",
},
{
id: "dFBbdkr",
name: "Vela",
meaning: "Sails",
starsWithPlanets: 7,
quadrant: "SQ2",
},
{
id: "dFBfdr",
name: "Moon",
meaning: "Sails",
starsWithPlanets: 17,
quadrant: "SQ3",
},
];
it("should make a GET request to the appropriate URL", async () => {
jest.spyOn(axios, "get");
await index();
const expectedURL = `${BASE_URL}/constellations`;
expect(axios.get).toHaveBeenCalledWith(expectedURL);
jest.clearAllMocks();
});
it("should return a list of constellations with fewer than 10 stars with planets", async () => {
// Write code here
expect(1).toBe(2);
});
it("should log an error to the console", async () => {
// Write code here
expect(1).toBe(2);
});
});
});