From a8bba3a5132bd4fef54333a4912f1bb12d3d05d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Skolak?= <76774237+Skolaczk@users.noreply.github.com> Date: Sat, 27 Jan 2024 20:45:05 +0100 Subject: [PATCH] CI/NS-5-configure-github-actions (#47) * ci: add github action - code check * test: fix home page test * test: test * test: fix intentional error --- .github/workflows/lint.yml | 30 ++++++++++++++++++++++++++++++ src/__tests__/home.test.tsx | 11 +++++++---- 2 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..94bb610 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,30 @@ +name: Code check + +on: + pull_request: + branches: + - main + +jobs: + lint: + name: Eslint, Typescript, prettier and test + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Install dependencies + run: npm install + + - name: ESLint + run: npm run lint + + - name: Type check + run: npm run typecheck + + - name: Prettier + run: npm run format:check + + - name: Tests + run: npm run test diff --git a/src/__tests__/home.test.tsx b/src/__tests__/home.test.tsx index c6ab428..1a87af1 100644 --- a/src/__tests__/home.test.tsx +++ b/src/__tests__/home.test.tsx @@ -6,10 +6,13 @@ describe('Homepage', () => { it('renders the Components', () => { render(); - const helloWorldElement = screen.getByText('Hello world', { - selector: 'h1', - }); + const heading = screen.getByText( + 'Next.js + TypeScript + TailwindCSS + Shadcn/ui', + { + selector: 'h1', + } + ); - expect(helloWorldElement).toBeInTheDocument(); + expect(heading).toBeInTheDocument(); }); });