From 541068941b201d329c73508591c645ea46e794af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Calcagno=20Lo=C3=AFc?=
<98493858+CalcagnoLoic@users.noreply.github.com>
Date: Sat, 27 Jan 2024 11:55:50 +0100
Subject: [PATCH] writing workflow
---
.../workflows/{chromatic.yaml => chromatic} | 0
.github/workflows/deploy.yaml | 21 ++++++++++++++++++
src/components/Counter/index.spec.tsx | 22 -------------------
.../Dropdown/BasketDropdown/index.spec.tsx | 16 --------------
4 files changed, 21 insertions(+), 38 deletions(-)
rename .github/workflows/{chromatic.yaml => chromatic} (100%)
create mode 100644 .github/workflows/deploy.yaml
delete mode 100644 src/components/Counter/index.spec.tsx
diff --git a/.github/workflows/chromatic.yaml b/.github/workflows/chromatic
similarity index 100%
rename from .github/workflows/chromatic.yaml
rename to .github/workflows/chromatic
diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml
new file mode 100644
index 0000000..4997a91
--- /dev/null
+++ b/.github/workflows/deploy.yaml
@@ -0,0 +1,21 @@
+name: "Deploy to Github Pages"
+
+on:
+ push:
+ branches:
+ - develop
+ - main
+
+jobs:
+ lint_and_test:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 20
+ cache: "npm"
+ - run: npm ci
+ - run: npm run lint
+ - run: npm run test
diff --git a/src/components/Counter/index.spec.tsx b/src/components/Counter/index.spec.tsx
deleted file mode 100644
index cd8ced2..0000000
--- a/src/components/Counter/index.spec.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-import { render, screen } from "@testing-library/react";
-import Counter from ".";
-import userEvent from "@testing-library/user-event";
-import { vi } from "vitest";
-import { BasketProvider } from "../../context/Basket/BasketContext";
-
-describe("Counter Component Suite Test", () => {
- it("should be modify the counter value if user click on quantity button", async () => {
- const setOnClicMock = vi.fn();
-
- render(
-
-
- ,
- );
-
- expect(setOnClicMock()).toHaveBeenCalledWith("add");
-
- const counterText = await screen.findByRole("paragraph", { name: "1" });
- expect(counterText).toBeInTheDocument();
- });
-});
diff --git a/src/components/Dropdown/BasketDropdown/index.spec.tsx b/src/components/Dropdown/BasketDropdown/index.spec.tsx
index 3f8bd5b..d1cd0c8 100644
--- a/src/components/Dropdown/BasketDropdown/index.spec.tsx
+++ b/src/components/Dropdown/BasketDropdown/index.spec.tsx
@@ -14,22 +14,6 @@ describe("Basket Dropdown Suite Test", () => {
expect(getByText("Your cart is empty.")).toBeInTheDocument();
});
- /* it("should be display the basket content with items", async () => {
- const { getByTestId } = render(
-
-
- {}} />
- ,
- );
-
- const quantityIconsPlus = getByTestId("plus-icon");
- userEvent.click(quantityIconsPlus);
-
- await waitFor(() => {
- expect(screen.queryByText("Your cart is empty.")).toBeNull();
- });
- }); */
-
it("should close the dropdown basket if user clicks outside", () => {
const setIsOpenMock = vi.fn();