-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustomer.httpApi.test.ts
More file actions
44 lines (38 loc) · 1.07 KB
/
Copy pathcustomer.httpApi.test.ts
File metadata and controls
44 lines (38 loc) · 1.07 KB
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
import { describe, expect, test } from "vitest";
import { Api, UpdateCustomerRequest } from "@common/api";
import { Config } from "sst/node/config";
describe("customer endpoint", () => {
const apiClient = new Api({
BASE: Config.HTTP_API,
}).default;
test("update customer - valid", async () => {
const customerId = "d290f1ee-6c54-4b01-90e6-d701748f0851";
const customer: UpdateCustomerRequest = {
name: "John",
surname: "Doe",
email: "john@doe.com",
};
const response = await apiClient.putCustomer(customerId, "web", customer);
expect(response).toEqual({
id: customerId,
...customer,
});
});
test("update customer - invalid schema", async () => {
const customerId = "d290f1ee-6c54-4b01-90e6-d701748f0851";
const customer = {
name: "John",
email: "john@doe.com",
};
await expect(
apiClient.putCustomer(customerId, "web", customer as any)
).rejects.toMatchObject({
body: [
{
path: ["surname"],
message: "Required",
},
],
});
});
});