44
55import * as React from 'react' ;
66import '@testing-library/jest-dom' ;
7- import { prettyDOM , render } from '@testing-library/react' ;
7+ import { render } from '@testing-library/react' ;
88import * as LibraryEntryPoint from '../../src/entry-point' ;
99import { LibraryItem } from '../../src/components/LibraryItem' ;
1010import { ItemData } from "../../src/LibraryUtilities" ;
@@ -28,13 +28,13 @@ describe("LibraryContainer", function () {
2828
2929 // When running for the first time creates a snapshot in __snapshots__ folder
3030 // To compare with the existing snapshot for subsequent running.
31- expect ( prettyDOM ( container ) ) . toMatchSnapshot ( ) ;
31+ expect ( container ) . toMatchSnapshot ( ) ;
3232 } ) ;
3333
3434 it ( "Test UI rendering of Library Item and child components" , function ( ) {
3535 // Render with render() to test child components
3636 const { container } = render ( libraryItemComponent ) ;
37- expect ( prettyDOM ( container ) ) . toMatchSnapshot ( ) ;
37+ expect ( container ) . toMatchSnapshot ( ) ;
3838 } ) ;
3939
4040 it ( "Demonstrate testing UIitems loads correctly from static data" , function ( ) {
@@ -55,8 +55,10 @@ describe("LibraryContainer", function () {
5555 libController . refreshLibraryView ( ) ;
5656
5757 // Search for all LibraryItems
58- let text = container . querySelectorAll ( 'div.LibraryItemText' ) [ 0 ] ;
59- expect ( prettyDOM ( text ) ) . toMatchSnapshot ( ) ;
58+ const text = container . querySelectorAll ( '.LibraryItemText' ) ;
59+ const serializedNodes = Array . from ( text ) . map ( ( node ) => node . outerHTML ) . join ( "\n" ) ;
60+ console . log ( 'text: ' , text ) ;
61+ expect ( serializedNodes ) . toMatchSnapshot ( ) ;
6062 } ) ;
6163} ) ;
6264
0 commit comments