File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ test('exposes debug method', () => {
2020 renderIntoDocument (
2121 `<button>test</button><span>multi-test</span><div>multi-test</div>` ,
2222 )
23- expect ( screen . debug ) . toBeInstanceOf ( Function )
2423 // log document
2524 screen . debug ( )
2625 expect ( console . log ) . toHaveBeenCalledTimes ( 1 )
@@ -37,27 +36,30 @@ test('exposes debug method', () => {
3736 </div>
3837 </body>"
3938 ` )
39+ console . log . mockClear ( )
4040 // log single element
4141 screen . debug ( screen . getByText ( 'test' , { selector : 'button' } ) )
42- expect ( console . log ) . toHaveBeenCalledTimes ( 2 )
43- expect ( console . log . mock . calls [ 1 ] [ 0 ] ) . toMatchInlineSnapshot ( `
42+ expect ( console . log ) . toHaveBeenCalledTimes ( 1 )
43+ expect ( console . log . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot ( `
4444 "<button>
4545 test
4646 </button>"
4747 ` )
48+ console . log . mockClear ( )
4849 // log multiple elements
4950 screen . debug ( screen . getAllByText ( 'multi-test' ) )
50- expect ( console . log ) . toHaveBeenCalledTimes ( 4 )
51- expect ( console . log . mock . calls [ 2 ] [ 0 ] ) . toMatchInlineSnapshot ( `
51+ expect ( console . log ) . toHaveBeenCalledTimes ( 2 )
52+ expect ( console . log . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot ( `
5253 "<span>
5354 multi-test
5455 </span>"
5556 ` )
56- expect ( console . log . mock . calls [ 3 ] [ 0 ] ) . toMatchInlineSnapshot ( `
57+ expect ( console . log . mock . calls [ 1 ] [ 0 ] ) . toMatchInlineSnapshot ( `
5758 "<div>
5859 multi-test
5960 </div>"
6061 ` )
62+ console . log . mockClear ( )
6163} )
6264
6365/* eslint no-console:0 */
You can’t perform that action at this time.
0 commit comments