@labdigital/commercetools-mock 2.45.1 → 2.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,40 @@
1
+ import type { Customer, CustomerDraft } from "@commercetools/platform-sdk";
2
+ import { Factory } from "fishery";
3
+ import supertest from "supertest";
4
+ import type { CommercetoolsMock } from "~src/ctMock";
5
+
6
+ export const customerDraftFactory = (m: CommercetoolsMock) =>
7
+ Factory.define<CustomerDraft, CustomerDraft, Customer>(({ onCreate }) => {
8
+ onCreate(async (draft) => {
9
+ const response = await supertest(m.app)
10
+ .post(`/dummy/customers`)
11
+ .send(draft);
12
+
13
+ return response.body.customer;
14
+ });
15
+
16
+ return {
17
+ email: "customer@example.com",
18
+ firstName: "John",
19
+ lastName: "Doe",
20
+ locale: "nl-NL",
21
+ password: "my-secret-pw",
22
+ addresses: [
23
+ {
24
+ firstName: "John",
25
+ lastName: "Doe",
26
+ streetName: "Street name",
27
+ streetNumber: "42",
28
+ postalCode: "1234 AB",
29
+ city: "Utrecht",
30
+ country: "NL",
31
+ company: "Lab Digital",
32
+ phone: "+31612345678",
33
+ email: "customer@example.com",
34
+ },
35
+ ],
36
+ isEmailVerified: false,
37
+ stores: [],
38
+ authenticationMode: "Password",
39
+ };
40
+ });