-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathall.test.js
36 lines (29 loc) · 1.01 KB
/
all.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
const { config } = require("dotenv");
const { getAll } = require("../api");
const {
validateUserSchema,
validateCartSchema,
validateProductSchema,
} = require("../schemas");
config();
describe("GET /users", () => {
test("should return json response which match expected user schema", async () => {
const result = await getAll(process.env.USERS_URL);
// expect result to match user schema
expect(validateUserSchema(result)).toBe(true);
});
});
describe("GET /products", () => {
test("should return json response which match expected product schema", async () => {
const result = await getAll(process.env.PRODUCTS_URL);
// expect result to match product schema
expect(validateProductSchema(result)).toBe(true);
});
});
describe("GET /carts", () => {
test("should return json response which match expected cart schema", async () => {
const result = await getAll(process.env.CARTS_URL);
// expect result to match cart schema
expect(validateCartSchema(result)).toBe(true);
});
});