diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2711c7b..27d5a89 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,6 +29,8 @@ jobs: run: npm install - name: Build run: npm run build + - name: Test + run: npm test -- --watch=false deploy: runs-on: self-hosted needs: build diff --git a/src/App.test.tsx b/src/App.test.tsx new file mode 100644 index 0000000..af2e4b5 --- /dev/null +++ b/src/App.test.tsx @@ -0,0 +1,9 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import App from './App'; + +test('Home screen contains \'MauMau\'', () => { + render(); + const linkElement = screen.getByText(/MauMau/i); + expect(linkElement).toBeInTheDocument(); +}); diff --git a/src/setupTests.ts b/src/setupTests.ts new file mode 100644 index 0000000..8f2609b --- /dev/null +++ b/src/setupTests.ts @@ -0,0 +1,5 @@ +// jest-dom adds custom jest matchers for asserting on DOM nodes. +// allows you to do things like: +// expect(element).toHaveTextContent(/react/i) +// learn more: https://github.com/testing-library/jest-dom +import '@testing-library/jest-dom';