Skip to content

Commit

Permalink
remove custom snapshotSerializers from jest config
Browse files Browse the repository at this point in the history
  • Loading branch information
EnzoBatistaU committed Nov 27, 2024
1 parent f5c2514 commit ec6217c
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 271 deletions.
12 changes: 7 additions & 5 deletions __tests__/Snapshottest/UIOutputComparisonTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 () {
Expand All @@ -55,8 +55,10 @@ describe("LibraryContainer", function () {
libController.refreshLibraryView();

// Search for all LibraryItems
let text = container.querySelectorAll('div.LibraryItemText')[0];
expect(prettyDOM(text)).toMatchSnapshot();
const text = container.querySelectorAll('.LibraryItemText');
const serializedNodes = Array.from(text).map((node)=> node.outerHTML).join("\n");
console.log('text: ', text);
expect(serializedNodes).toMatchSnapshot();
});
});

Loading

0 comments on commit ec6217c

Please sign in to comment.