From 388c9b699d42e580c12f290c6fdf36c6658b8b32 Mon Sep 17 00:00:00 2001 From: louis Date: Sun, 7 Jan 2024 21:02:39 +0100 Subject: [PATCH] Remove Snapshot Tests --- package.json | 1 + src/components/Attachments.test.tsx | 21 - src/components/Message.test.tsx | 20 +- .../__snapshots__/Attachments.test.tsx.snap | 323 ----------- .../__snapshots__/Message.test.tsx.snap | 513 ------------------ yarn.lock | 153 +++++- 6 files changed, 150 insertions(+), 881 deletions(-) delete mode 100644 src/components/Attachments.test.tsx delete mode 100644 src/components/__snapshots__/Attachments.test.tsx.snap delete mode 100644 src/components/__snapshots__/Message.test.tsx.snap diff --git a/package.json b/package.json index 96a9e97..bd31eac 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "@testing-library/jest-dom": "6.2.0", "@testing-library/react": "^14.1.2", "@testing-library/user-event": "^14.5.2", + "@types/jest": "^29.5.11", "@types/node": "^20.10.7", "@types/react-dom": "^18.2.17", "@typescript-eslint/eslint-plugin": "^6.17.0", diff --git a/src/components/Attachments.test.tsx b/src/components/Attachments.test.tsx deleted file mode 100644 index 2bfa7c1..0000000 --- a/src/components/Attachments.test.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { render } from '@testing-library/react' -import Attachments from './Attachments' - -describe('Attachment', function () { - test('renders single image correctly', function () { - const attachments = [{ contentType: 'image/jpeg', url: 'https://example.com/image.jpg' }] - const { asFragment } = render() - - expect(asFragment()).toMatchSnapshot() - }) - - test('renders multiple images as slider', function () { - const attachments = [ - { contentType: 'image/jpeg', url: 'https://example.com/image.jpg' }, - { contentType: 'image/jpeg', url: 'https://example.com/image.jpg' }, - ] - const { asFragment } = render() - - expect(asFragment()).toMatchSnapshot() - }) -}) diff --git a/src/components/Message.test.tsx b/src/components/Message.test.tsx index 6868291..46cadcb 100644 --- a/src/components/Message.test.tsx +++ b/src/components/Message.test.tsx @@ -11,25 +11,7 @@ describe('Message', function () { attachments: [], geoInformation: '{"type":"FeatureCollection","features":[]}', } - const { asFragment } = render() - - expect(asFragment()).toMatchSnapshot() - + render() expect(screen.getByText('a few seconds ago')).toBeInTheDocument() }) - - test('renders with map correctly', function () { - const message = { - id: '1', - text: 'message', - ticker: 1, - createdAt: new Date(), - attachments: [], - geoInformation: - '{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[13.466282,52.5024]},"properties":null}]}', - } - const { asFragment } = render() - - expect(asFragment()).toMatchSnapshot() - }) }) diff --git a/src/components/__snapshots__/Attachments.test.tsx.snap b/src/components/__snapshots__/Attachments.test.tsx.snap deleted file mode 100644 index 3c1b56f..0000000 --- a/src/components/__snapshots__/Attachments.test.tsx.snap +++ /dev/null @@ -1,323 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`Attachment > renders multiple images as slider 1`] = ` - -