From 1ed86161f1ae660f59f708fe6d3734121e2586f6 Mon Sep 17 00:00:00 2001 From: DTieman Date: Fri, 24 Mar 2023 18:27:28 +0100 Subject: [PATCH] re-added tests for when we ever decide to use them --- .github/workflows/main.yml | 2 ++ src/App.test.tsx | 9 +++++++++ src/setupTests.ts | 5 +++++ 3 files changed, 16 insertions(+) create mode 100644 src/App.test.tsx create mode 100644 src/setupTests.ts 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';