From 3257ce468a2af13d51de65b2b9dcf3ee039828d1 Mon Sep 17 00:00:00 2001 From: Soham Mondal <34343502+sohammondal@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:28:06 +0200 Subject: [PATCH] ci: add Unit & Integration test Gh Action (#6) * ci: add Unit & Integration test Gh Action * chore: change to trigger test --- .github/workflows/unit-test.yml | 22 ++++++++++++++++++++++ components/Accordion/Accordion.test.tsx | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/unit-test.yml diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml new file mode 100644 index 0000000..aef8feb --- /dev/null +++ b/.github/workflows/unit-test.yml @@ -0,0 +1,22 @@ +name: Unit & Integration Tests +on: + pull_request: + branches: [main, stage] +jobs: + Test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts/* + - name: Install dependencies + run: npm i + - name: Unit & Integration Tests + run: npm run test:ci + - uses: actions/upload-artifact@v4 + if: always() + with: + name: test-report.html + path: reports/test-report.html + retention-days: 30 diff --git a/components/Accordion/Accordion.test.tsx b/components/Accordion/Accordion.test.tsx index 96b3f76..60e5e2d 100644 --- a/components/Accordion/Accordion.test.tsx +++ b/components/Accordion/Accordion.test.tsx @@ -4,8 +4,8 @@ import { Accordion } from "./Accordion"; describe("Accordion", () => { it("should toggle content when clicked", async () => { - const title = "Section 1"; - const content = "This is the content for section 1."; + const title = "Accordion Title"; + const content = "This is the content for Accordion"; render({content});