@plurix/ecom-components 0.0.2-beta.6 → 0.0.2-beta.8
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.
- package/dist/packages/Carousel/Carousel.js +3 -3
- package/dist/packages/Onboarding/Onboarding.js +1 -1
- package/dist/packages/Regionalization/components/Delivery.js +2 -2
- package/dist/packages/Regionalization/components/Title.js +1 -1
- package/dist/packages/Regionalization/context/RegionalizationContext.js +2 -2
- package/dist/packages/Regionalization/utils/deliverySetData.js +1 -1
- package/dist/packages/Regionalization/utils/localStorage.js +3 -3
- package/dist/packages/Regionalization/utils/postalCode.d.ts +2 -1
- package/dist/packages/Regionalization/views/AllStoresScreen.js +1 -1
- package/dist/packages/Regionalization/views/ConfirmScreen.js +2 -2
- package/dist/packages/Regionalization/views/InitialView.js +1 -1
- package/dist/packages/Regionalization/views/PostalCodeInputScreen.js +1 -1
- package/dist/packages/Tour/components/TourTooltip.d.ts +1 -1
- package/dist/packages/Tour/test/Tour.test.js +20 -24
- package/package.json +1 -1
- package/dist/packages/Onboarding/test/Bullets.test.js +0 -20
- package/dist/packages/Onboarding/test/Content.test.js +0 -52
- package/dist/packages/Onboarding/test/Footer.test.js +0 -60
- package/dist/packages/Onboarding/test/Header.test.js +0 -30
- package/dist/packages/Onboarding/test/Onboarding.test.js +0 -22
- package/dist/packages/Onboarding/test/SocialMedia.test.js +0 -39
|
@@ -67,7 +67,7 @@ import { DefaultProps as L } from "./utils/defaultProps.js";
|
|
|
67
67
|
{
|
|
68
68
|
position: "prev",
|
|
69
69
|
style: f.arrows,
|
|
70
|
-
iconColor: r.iconColor
|
|
70
|
+
iconColor: r.iconColor || "#ccc",
|
|
71
71
|
onClick: () => W("prev")
|
|
72
72
|
}
|
|
73
73
|
) }),
|
|
@@ -98,7 +98,7 @@ import { DefaultProps as L } from "./utils/defaultProps.js";
|
|
|
98
98
|
{
|
|
99
99
|
position: "next",
|
|
100
100
|
style: f.arrows,
|
|
101
|
-
iconColor: r.iconColor
|
|
101
|
+
iconColor: r.iconColor || "#ccc",
|
|
102
102
|
onClick: () => W("next")
|
|
103
103
|
}
|
|
104
104
|
) : "" })
|
|
@@ -115,7 +115,7 @@ import { DefaultProps as L } from "./utils/defaultProps.js";
|
|
|
115
115
|
style: {
|
|
116
116
|
...f.bullets,
|
|
117
117
|
transition: "all 0.8s ease-out",
|
|
118
|
-
backgroundColor: `${M === e ? (c == null ? void 0 : c.bulletEnableColor)
|
|
118
|
+
backgroundColor: `${M === e ? (c == null ? void 0 : c.bulletEnableColor) || "#ff0000" : (c == null ? void 0 : c.bulletDisableColor) || "#ccc"}`
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
121
|
e
|
|
@@ -4,14 +4,14 @@ import { DeliveryExpress as S } from "./DeliveryExpress.js";
|
|
|
4
4
|
import { useRegionalizationContext as f } from "../context/RegionalizationContext.js";
|
|
5
5
|
const C = ({ containerClassName: g, delivery: e }) => {
|
|
6
6
|
var o, i, p, c, m;
|
|
7
|
-
const { customShippingData: l } = f(), { shippingList: s, isExpressEligible: D, expressShippingCmsQuantity: a } = l
|
|
7
|
+
const { customShippingData: l } = f(), { shippingList: s, isExpressEligible: D, expressShippingCmsQuantity: a } = l || {}, n = {
|
|
8
8
|
normalDeliveryPrice: (o = s == null ? void 0 : s.find(
|
|
9
9
|
(r) => r.id === "Entrega Padrão"
|
|
10
10
|
)) == null ? void 0 : o.listPrice,
|
|
11
11
|
expressDeliveryPrice: (i = s == null ? void 0 : s.find(
|
|
12
12
|
(r) => r.id === "Entrega Express"
|
|
13
13
|
)) == null ? void 0 : i.listPrice,
|
|
14
|
-
shippingEstimate: ((p = s == null ? void 0 : s.find((r) => r.id === "Entrega Express")) == null ? void 0 : p.shippingEstimate)
|
|
14
|
+
shippingEstimate: ((p = s == null ? void 0 : s.find((r) => r.id === "Entrega Express")) == null ? void 0 : p.shippingEstimate) || "",
|
|
15
15
|
expressShippingQuantity: a || ""
|
|
16
16
|
}, E = (c = e == null ? void 0 : e.expressMessage) == null ? void 0 : c.replace(
|
|
17
17
|
"$Q",
|
|
@@ -30,8 +30,8 @@ const v = _(null), ae = ({
|
|
|
30
30
|
children: j
|
|
31
31
|
}) => {
|
|
32
32
|
const [B, u] = e(), [F, g] = e("InitialView"), [L, m] = e(""), [Q, $] = e(), [s, A] = e(), [G, f] = e(), [J, K] = e(), [N, O] = e(!1), U = {
|
|
33
|
-
openingTime: (s == null ? void 0 : s.businessHours.businessHoursWeek.openingTime.slice(0, 2))
|
|
34
|
-
closingTime: (s == null ? void 0 : s.businessHours.businessHoursWeek.closingTime.slice(0, 2))
|
|
33
|
+
openingTime: (s == null ? void 0 : s.businessHours.businessHoursWeek.openingTime.slice(0, 2)) || "",
|
|
34
|
+
closingTime: (s == null ? void 0 : s.businessHours.businessHoursWeek.closingTime.slice(0, 2)) || ""
|
|
35
35
|
}, X = async () => {
|
|
36
36
|
i({ loading: !0, message: "Carregando..." });
|
|
37
37
|
const {
|
|
@@ -6,7 +6,7 @@ const c = (i, t, m) => {
|
|
|
6
6
|
deliveryName: String(t == null ? void 0 : t.deliveryName),
|
|
7
7
|
shippingEstimate: String(t == null ? void 0 : t.shippingEstimate)
|
|
8
8
|
});
|
|
9
|
-
g("postalCode", m
|
|
9
|
+
g("postalCode", m || ""), g("method", "delivery"), g("deliveryInfos", p);
|
|
10
10
|
};
|
|
11
11
|
export {
|
|
12
12
|
c as deliverySetData
|
|
@@ -5,11 +5,11 @@ const n = (t, e) => {
|
|
|
5
5
|
if (a)
|
|
6
6
|
return localStorage.getItem(t);
|
|
7
7
|
}, d = () => {
|
|
8
|
-
const t = s("postalCode"), e = s("method"), o = JSON.parse(s("deliveryInfos")
|
|
9
|
-
postalCode: t
|
|
8
|
+
const t = s("postalCode"), e = s("method"), o = JSON.parse(s("deliveryInfos") || "{}"), c = {
|
|
9
|
+
postalCode: t || "00000-000",
|
|
10
10
|
city: o == null ? void 0 : o.city,
|
|
11
11
|
uf: o == null ? void 0 : o.uf
|
|
12
|
-
}, r = e
|
|
12
|
+
}, r = e || void 0;
|
|
13
13
|
return {
|
|
14
14
|
regionalized: r,
|
|
15
15
|
deliveryInfos: r ? o : void 0,
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const postalCodeMask: (e: React.KeyboardEvent<HTMLInputElement>) => import('react').KeyboardEvent<HTMLInputElement>;
|
|
2
3
|
export declare const removeSpecialCharacter: (value: string) => string;
|
|
@@ -16,7 +16,7 @@ const E = () => {
|
|
|
16
16
|
l == null ? void 0 : l.filter(
|
|
17
17
|
({ name: t }) => {
|
|
18
18
|
var c;
|
|
19
|
-
return t.toLowerCase().includes(((c = a.current) == null ? void 0 : c.value.toLowerCase())
|
|
19
|
+
return t.toLowerCase().includes(((c = a.current) == null ? void 0 : c.value.toLowerCase()) || "");
|
|
20
20
|
}
|
|
21
21
|
)
|
|
22
22
|
);
|
|
@@ -15,7 +15,7 @@ const I = () => {
|
|
|
15
15
|
internalMethod: l,
|
|
16
16
|
pickupTimes: a,
|
|
17
17
|
pickupConfirmScreenText: c
|
|
18
|
-
} = v(), d = `Retiradas entre ${(a == null ? void 0 : a.openingTime)
|
|
18
|
+
} = v(), d = `Retiradas entre ${(a == null ? void 0 : a.openingTime) || "08"}h e ${(a == null ? void 0 : a.closingTime) || "20"}h, ou agendada`, h = c && c !== "" ? c : d;
|
|
19
19
|
return /* @__PURE__ */ o(m, { children: [
|
|
20
20
|
/* @__PURE__ */ n(
|
|
21
21
|
f,
|
|
@@ -30,7 +30,7 @@ const I = () => {
|
|
|
30
30
|
] }),
|
|
31
31
|
l === "delivery" ? /* @__PURE__ */ o(m, { children: [
|
|
32
32
|
/* @__PURE__ */ n("span", { children: t == null ? void 0 : t.cep }),
|
|
33
|
-
/* @__PURE__ */ n("span", { className: "address-delivery", children: (t == null ? void 0 : t.logradouro)
|
|
33
|
+
/* @__PURE__ */ n("span", { className: "address-delivery", children: (t == null ? void 0 : t.logradouro) || (t == null ? void 0 : t.localidade) })
|
|
34
34
|
] }) : /* @__PURE__ */ o(m, { children: [
|
|
35
35
|
/* @__PURE__ */ n("span", { children: r == null ? void 0 : r.name }),
|
|
36
36
|
/* @__PURE__ */ o("p", { className: "address-pickup", children: [
|
|
@@ -33,7 +33,7 @@ const R = () => {
|
|
|
33
33
|
/* @__PURE__ */ e("h4", { children: "Receber em casa" }),
|
|
34
34
|
/* @__PURE__ */ i("p", { children: [
|
|
35
35
|
" A partir de ",
|
|
36
|
-
u(m
|
|
36
|
+
u(m || 0)
|
|
37
37
|
] })
|
|
38
38
|
] }),
|
|
39
39
|
/* @__PURE__ */ i(n, { view: "PickupPointInfoScreen", className: "option", children: [
|
|
@@ -1,49 +1,45 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { render as
|
|
2
|
+
import l from "react";
|
|
3
|
+
import { render as i, fireEvent as a } from "@testing-library/react";
|
|
4
4
|
import "@testing-library/jest-dom";
|
|
5
|
-
import { Tour as
|
|
6
|
-
jest.mock("../components/TourTooltip", () => ({ TourTooltip:
|
|
7
|
-
(
|
|
5
|
+
import { Tour as s } from "../Tour.js";
|
|
6
|
+
jest.mock("../components/TourTooltip", () => ({ TourTooltip: l.forwardRef(
|
|
7
|
+
(e, o) => /* @__PURE__ */ r("div", { ref: o, "data-testid": "tour-tooltip" })
|
|
8
8
|
) }));
|
|
9
9
|
jest.mock("../components/TourOverlay", () => ({
|
|
10
|
-
TourOverlay: ({
|
|
11
|
-
stepNumber: n,
|
|
12
|
-
onClick: e,
|
|
13
|
-
...t
|
|
14
|
-
}) => /* @__PURE__ */ r("div", { ...t, onClick: e, "data-testid": "tour-overlay" })
|
|
10
|
+
TourOverlay: ({ onClick: t }) => /* @__PURE__ */ r("div", { onClick: t, "data-testid": "tour-overlay" })
|
|
15
11
|
}));
|
|
16
12
|
describe("Tour", () => {
|
|
17
|
-
const
|
|
13
|
+
const t = [
|
|
18
14
|
{ selector: ".step-1", content: "Step 1 Content" },
|
|
19
15
|
{ selector: ".step-2", content: "Step 2 Content" },
|
|
20
16
|
{ selector: ".step-3", content: "Step 3 Content" }
|
|
21
|
-
], e = jest.fn(),
|
|
17
|
+
], e = jest.fn(), o = jest.fn(), c = jest.fn();
|
|
22
18
|
it("should render correctly with initial step", () => {
|
|
23
|
-
const { getByTestId:
|
|
19
|
+
const { getByTestId: n } = i(
|
|
24
20
|
/* @__PURE__ */ r(
|
|
25
|
-
|
|
21
|
+
s,
|
|
26
22
|
{
|
|
27
|
-
steps:
|
|
23
|
+
steps: t,
|
|
28
24
|
handleCloseAction: e,
|
|
29
|
-
handleFinishAction:
|
|
30
|
-
genericTaggingEvent:
|
|
25
|
+
handleFinishAction: o,
|
|
26
|
+
genericTaggingEvent: c
|
|
31
27
|
}
|
|
32
28
|
)
|
|
33
29
|
);
|
|
34
|
-
expect(
|
|
30
|
+
expect(n("tour-tooltip")).toBeInTheDocument(), expect(n("tour-overlay")).toBeInTheDocument();
|
|
35
31
|
}), it("should call handleCloseAction when TourOverlay is clicked", () => {
|
|
36
|
-
const { getByTestId:
|
|
32
|
+
const { getByTestId: n } = i(
|
|
37
33
|
/* @__PURE__ */ r(
|
|
38
|
-
|
|
34
|
+
s,
|
|
39
35
|
{
|
|
40
|
-
steps:
|
|
36
|
+
steps: t,
|
|
41
37
|
handleCloseAction: e,
|
|
42
|
-
handleFinishAction:
|
|
43
|
-
genericTaggingEvent:
|
|
38
|
+
handleFinishAction: o,
|
|
39
|
+
genericTaggingEvent: c
|
|
44
40
|
}
|
|
45
41
|
)
|
|
46
42
|
);
|
|
47
|
-
|
|
43
|
+
a.click(n("tour-overlay")), expect(e).toHaveBeenCalled();
|
|
48
44
|
});
|
|
49
45
|
});
|
package/package.json
CHANGED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import { render as s } from "@testing-library/react";
|
|
3
|
-
import "@testing-library/jest-dom";
|
|
4
|
-
import { Bullets as o } from "../components/Bullets.js";
|
|
5
|
-
jest.mock("../constants/tips", () => ({ TIPS_LENGTH: 3 }));
|
|
6
|
-
describe("Bullets component tests", () => {
|
|
7
|
-
it("renders correctly amount of bullets", () => {
|
|
8
|
-
const { container: t } = s(/* @__PURE__ */ l(o, { step: 1 })), e = t.querySelectorAll(".bullet");
|
|
9
|
-
expect(e.length).toBe(3);
|
|
10
|
-
}), it("should first bullet active if step is 1", () => {
|
|
11
|
-
const { container: t } = s(/* @__PURE__ */ l(o, { step: 1 })), e = t.querySelector(".bullet");
|
|
12
|
-
expect(e).toHaveClass("active");
|
|
13
|
-
}), it("should middle bullet active if step is greater than 1 and less than TIPS_LENGTH", () => {
|
|
14
|
-
const { container: t } = s(/* @__PURE__ */ l(o, { step: 2 })), e = t.querySelector(".bullet:nth-child(2)");
|
|
15
|
-
expect(e).toHaveClass("active");
|
|
16
|
-
}), it("should last bullet active if step is equal than TIPS_LENGTH", () => {
|
|
17
|
-
const { container: t } = s(/* @__PURE__ */ l(o, { step: 3 })), e = t.querySelector(".bullet:last-child");
|
|
18
|
-
expect(e).toHaveClass("active");
|
|
19
|
-
});
|
|
20
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { render as s } from "@testing-library/react";
|
|
3
|
-
import "@testing-library/jest-dom";
|
|
4
|
-
import { Content as o } from "../components/Content.js";
|
|
5
|
-
jest.mock("../components/SocialMedia", () => ({
|
|
6
|
-
SocialMedia: () => /* @__PURE__ */ e("div", { "data-testid": "social media" })
|
|
7
|
-
}));
|
|
8
|
-
jest.mock("../constants/tips", () => ({
|
|
9
|
-
TIPS_LENGTH: 2,
|
|
10
|
-
TIPS: [
|
|
11
|
-
{
|
|
12
|
-
tip: "tip 1",
|
|
13
|
-
svg: () => /* @__PURE__ */ e("div", { "data-testid": "svg 1" }),
|
|
14
|
-
isIllustration: !1
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
tip: "tip 2",
|
|
18
|
-
svg: () => /* @__PURE__ */ e("div", { "data-testid": "svg 2" }),
|
|
19
|
-
isIllustration: !0
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
}));
|
|
23
|
-
const n = jest.fn();
|
|
24
|
-
describe("Content component tests", () => {
|
|
25
|
-
it("should render nothing if step is invalid", () => {
|
|
26
|
-
const { container: t } = s(/* @__PURE__ */ e(o, { step: 0, sendEvent: n }));
|
|
27
|
-
expect(t.firstChild).toBeNull();
|
|
28
|
-
}), it("should render correctly texts", () => {
|
|
29
|
-
const { getByTestId: t, getByText: i } = s(
|
|
30
|
-
/* @__PURE__ */ e(o, { step: 1, sendEvent: n })
|
|
31
|
-
);
|
|
32
|
-
expect(t("svg 1")).toBeInTheDocument(), expect(i("1 de 2")).toBeInTheDocument(), expect(i("tip 1")).toBeInTheDocument();
|
|
33
|
-
}), it("should render correctly illustration message", () => {
|
|
34
|
-
const { getByText: t } = s(/* @__PURE__ */ e(o, { step: 2, sendEvent: n }));
|
|
35
|
-
expect(t("Imagem Ilustrativa")).toBeInTheDocument();
|
|
36
|
-
}), it("should render correctly social media section", () => {
|
|
37
|
-
const { getByTestId: t } = s(
|
|
38
|
-
/* @__PURE__ */ e(
|
|
39
|
-
o,
|
|
40
|
-
{
|
|
41
|
-
step: 2,
|
|
42
|
-
socialMediaLinks: {
|
|
43
|
-
facebook: "facebook_link",
|
|
44
|
-
instagram: "instagram_link"
|
|
45
|
-
},
|
|
46
|
-
sendEvent: n
|
|
47
|
-
}
|
|
48
|
-
)
|
|
49
|
-
);
|
|
50
|
-
expect(t("social media")).toBeInTheDocument();
|
|
51
|
-
});
|
|
52
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { render as c, fireEvent as a } from "@testing-library/react";
|
|
3
|
-
import "@testing-library/jest-dom";
|
|
4
|
-
import { Footer as l } from "../components/Footer.js";
|
|
5
|
-
jest.mock("../constants/tips", () => ({ TIPS_LENGTH: 3 }));
|
|
6
|
-
jest.mock("../components/Bullets", () => ({
|
|
7
|
-
Bullets: () => /* @__PURE__ */ n("div", { "data-testid": "bullets" })
|
|
8
|
-
}));
|
|
9
|
-
const t = jest.fn(), o = jest.fn();
|
|
10
|
-
describe("Footer component tests", () => {
|
|
11
|
-
it("renders default UI", () => {
|
|
12
|
-
const { getByText: e } = c(
|
|
13
|
-
/* @__PURE__ */ n(
|
|
14
|
-
l,
|
|
15
|
-
{
|
|
16
|
-
step: 1,
|
|
17
|
-
handleBackStep: t,
|
|
18
|
-
handleNextStep: o
|
|
19
|
-
}
|
|
20
|
-
)
|
|
21
|
-
);
|
|
22
|
-
expect(e("Voltar")).toBeInTheDocument(), expect(e("Próximo")).toBeInTheDocument();
|
|
23
|
-
}), it("renders correctly button text if step is equal than TIPS_LENGTH", () => {
|
|
24
|
-
const { queryByText: e, getByText: s } = c(
|
|
25
|
-
/* @__PURE__ */ n(
|
|
26
|
-
l,
|
|
27
|
-
{
|
|
28
|
-
step: 3,
|
|
29
|
-
handleBackStep: t,
|
|
30
|
-
handleNextStep: o
|
|
31
|
-
}
|
|
32
|
-
)
|
|
33
|
-
);
|
|
34
|
-
expect(e("Próximo")).not.toBeInTheDocument(), expect(s("Legal, Entendi")).toBeInTheDocument();
|
|
35
|
-
}), it("should call handleBackStep on click back button", () => {
|
|
36
|
-
const { getByText: e } = c(
|
|
37
|
-
/* @__PURE__ */ n(
|
|
38
|
-
l,
|
|
39
|
-
{
|
|
40
|
-
step: 1,
|
|
41
|
-
handleBackStep: t,
|
|
42
|
-
handleNextStep: o
|
|
43
|
-
}
|
|
44
|
-
)
|
|
45
|
-
);
|
|
46
|
-
a.click(e("Voltar")), expect(t).toHaveBeenCalled();
|
|
47
|
-
}), it("should call handleNextStep on click confirm button", () => {
|
|
48
|
-
const { getByText: e } = c(
|
|
49
|
-
/* @__PURE__ */ n(
|
|
50
|
-
l,
|
|
51
|
-
{
|
|
52
|
-
step: 1,
|
|
53
|
-
handleBackStep: t,
|
|
54
|
-
handleNextStep: o
|
|
55
|
-
}
|
|
56
|
-
)
|
|
57
|
-
);
|
|
58
|
-
a.click(e("Próximo")), expect(o).toHaveBeenCalled();
|
|
59
|
-
});
|
|
60
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { render as c, fireEvent as d } from "@testing-library/react";
|
|
3
|
-
import "@testing-library/jest-dom";
|
|
4
|
-
import { Header as s } from "../components/Header.js";
|
|
5
|
-
const t = jest.fn(), n = jest.fn();
|
|
6
|
-
describe("Header component tests", () => {
|
|
7
|
-
it("renders correctly UI", () => {
|
|
8
|
-
const { getByText: e, getByTestId: l } = c(
|
|
9
|
-
/* @__PURE__ */ o(
|
|
10
|
-
s,
|
|
11
|
-
{
|
|
12
|
-
sendEvent: t,
|
|
13
|
-
handleCloseAction: n
|
|
14
|
-
}
|
|
15
|
-
)
|
|
16
|
-
);
|
|
17
|
-
expect(e("Experiência Personalizada")).toBeInTheDocument(), expect(l("close-icon")).toBeInTheDocument();
|
|
18
|
-
}), it("should call sendEvent and handleCloseAction on click close button", () => {
|
|
19
|
-
const { getByTestId: e } = c(
|
|
20
|
-
/* @__PURE__ */ o(
|
|
21
|
-
s,
|
|
22
|
-
{
|
|
23
|
-
sendEvent: t,
|
|
24
|
-
handleCloseAction: n
|
|
25
|
-
}
|
|
26
|
-
)
|
|
27
|
-
);
|
|
28
|
-
d.click(e("close-icon")), expect(t).toHaveBeenCalled(), expect(n).toHaveBeenCalled();
|
|
29
|
-
});
|
|
30
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { render as o } from "@testing-library/react";
|
|
3
|
-
import "@testing-library/jest-dom";
|
|
4
|
-
import { Onboarding as n } from "../Onboarding.js";
|
|
5
|
-
jest.mock("../components/Header", () => ({
|
|
6
|
-
Header: () => /* @__PURE__ */ e("div", { "data-testid": "header" })
|
|
7
|
-
}));
|
|
8
|
-
jest.mock("../components/Content", () => ({
|
|
9
|
-
Content: () => /* @__PURE__ */ e("div", { "data-testid": "content" })
|
|
10
|
-
}));
|
|
11
|
-
jest.mock("../components/Footer", () => ({
|
|
12
|
-
Footer: () => /* @__PURE__ */ e("div", { "data-testid": "footer" })
|
|
13
|
-
}));
|
|
14
|
-
const c = jest.fn();
|
|
15
|
-
describe("Onboarding package tests", () => {
|
|
16
|
-
it("should render sections correctly", () => {
|
|
17
|
-
const { getByTestId: t } = o(
|
|
18
|
-
/* @__PURE__ */ e(n, { handleCloseAction: c })
|
|
19
|
-
);
|
|
20
|
-
expect(t("header")).toBeInTheDocument(), expect(t("content")).toBeInTheDocument(), expect(t("footer")).toBeInTheDocument();
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { render as n, fireEvent as c } from "@testing-library/react";
|
|
3
|
-
import "@testing-library/jest-dom";
|
|
4
|
-
import { SocialMedia as t } from "../components/SocialMedia.js";
|
|
5
|
-
const o = jest.fn();
|
|
6
|
-
describe("SocialMedia component tests", () => {
|
|
7
|
-
it("should render nothing if socialMediaLinks does not exist", () => {
|
|
8
|
-
const { container: e } = n(/* @__PURE__ */ i(t, { sendEvent: o }));
|
|
9
|
-
expect(e.firstChild).toBeNull();
|
|
10
|
-
}), it("should render media section if link exist", () => {
|
|
11
|
-
const { getByTestId: e } = n(
|
|
12
|
-
/* @__PURE__ */ i(
|
|
13
|
-
t,
|
|
14
|
-
{
|
|
15
|
-
socialMediaLinks: {
|
|
16
|
-
facebook: "facebook_link",
|
|
17
|
-
instagram: "instagram_link"
|
|
18
|
-
},
|
|
19
|
-
sendEvent: o
|
|
20
|
-
}
|
|
21
|
-
)
|
|
22
|
-
);
|
|
23
|
-
expect(e("facebook-icon")).toBeInTheDocument(), expect(e("instagram-icon")).toBeInTheDocument();
|
|
24
|
-
}), it("should call sendEvent on click social media link", () => {
|
|
25
|
-
const { getByTestId: e } = n(
|
|
26
|
-
/* @__PURE__ */ i(
|
|
27
|
-
t,
|
|
28
|
-
{
|
|
29
|
-
socialMediaLinks: {
|
|
30
|
-
facebook: "facebook_link",
|
|
31
|
-
instagram: "instagram_link"
|
|
32
|
-
},
|
|
33
|
-
sendEvent: o
|
|
34
|
-
}
|
|
35
|
-
)
|
|
36
|
-
);
|
|
37
|
-
c.click(e("facebook-icon")), expect(o).toHaveBeenCalledWith("facebook");
|
|
38
|
-
});
|
|
39
|
-
});
|