From 466bbdfd32e909339243bf8dca5cacb5044e6074 Mon Sep 17 00:00:00 2001 From: enzo707 Date: Tue, 26 Nov 2024 20:42:19 -0300 Subject: [PATCH] remove custom snapshotSerializers from jest config --- __tests__/Snapshottest/UIOutputComparisonTests.tsx | 10 +++++----- jest.config.ts | 3 --- src/components/LibraryItem.tsx | 1 - 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/__tests__/Snapshottest/UIOutputComparisonTests.tsx b/__tests__/Snapshottest/UIOutputComparisonTests.tsx index 08db416..67a64e5 100644 --- a/__tests__/Snapshottest/UIOutputComparisonTests.tsx +++ b/__tests__/Snapshottest/UIOutputComparisonTests.tsx @@ -4,7 +4,7 @@ import * as React from 'react'; import '@testing-library/jest-dom'; -import { prettyDOM, render } from '@testing-library/react'; +import { render } from '@testing-library/react'; import * as LibraryEntryPoint from '../../src/entry-point'; import { LibraryItem } from '../../src/components/LibraryItem'; import { ItemData } from "../../src/LibraryUtilities"; @@ -28,13 +28,13 @@ describe("LibraryContainer", function () { // When running for the first time creates a snapshot in __snapshots__ folder // To compare with the existing snapshot for subsequent running. - expect(prettyDOM(container)).toMatchSnapshot(); + expect(container).toMatchSnapshot(); }); it("Test UI rendering of Library Item and child components", function () { // Render with render() to test child components const { container } = render(libraryItemComponent); - expect(prettyDOM(container)).toMatchSnapshot(); + expect(container).toMatchSnapshot(); }); it("Demonstrate testing UIitems loads correctly from static data", function () { @@ -55,8 +55,8 @@ describe("LibraryContainer", function () { libController.refreshLibraryView(); // Search for all LibraryItems - let text = container.querySelectorAll('div.LibraryItemText')[0]; - expect(prettyDOM(text)).toMatchSnapshot(); + const text = container.querySelectorAll('div.LibraryItemText')[0]; + expect(text).toMatchSnapshot(); }); }); diff --git a/jest.config.ts b/jest.config.ts index 31facc6..0380986 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -23,9 +23,6 @@ const config: Config = { testPathIgnorePatterns: [ "__tests__/data/" ], - snapshotSerializers: [ - "/node_modules/enzyme-to-json/serializer" - ], reporters: [ "default", [ diff --git a/src/components/LibraryItem.tsx b/src/components/LibraryItem.tsx index b4cebdf..a3129a2 100644 --- a/src/components/LibraryItem.tsx +++ b/src/components/LibraryItem.tsx @@ -417,7 +417,6 @@ export class LibraryItem extends React.Component