From 30974c61ddec5e2dc5cb3ad2046555af217cf9b2 Mon Sep 17 00:00:00 2001 From: Cee Chen Date: Wed, 22 May 2024 13:27:27 -0700 Subject: [PATCH] Silence console warning in test --- packages/eui/src/components/date_picker/date_picker.test.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/eui/src/components/date_picker/date_picker.test.tsx b/packages/eui/src/components/date_picker/date_picker.test.tsx index 5e8f53b5f35..0928286c511 100644 --- a/packages/eui/src/components/date_picker/date_picker.test.tsx +++ b/packages/eui/src/components/date_picker/date_picker.test.tsx @@ -23,6 +23,8 @@ describe('EuiDatePicker', () => { }); it('handles invalid `selected` dates', async () => { + // Silence the console warning from the invalid moment date + jest.spyOn(console, 'warn').mockImplementation(() => {}); const { container } = render( ); @@ -38,6 +40,8 @@ describe('EuiDatePicker', () => { expect(calendar).toBeInTheDocument(); const selected = document.querySelector('.react-datepicker__day--selected'); expect(selected).not.toBeInTheDocument(); + + jest.restoreAllMocks(); }); test('compressed', () => {