From fa44aebeff842ab5b2e374695fd59b24d2f5269a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Fern=C3=A1ndez?= Date: Mon, 4 Mar 2024 11:38:00 +0100 Subject: [PATCH] ReturnToPrevious: Improve tests (#83812) --- .../AppChrome/ReturnToPrevious/ReturnToPrevious.test.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/app/core/components/AppChrome/ReturnToPrevious/ReturnToPrevious.test.tsx b/public/app/core/components/AppChrome/ReturnToPrevious/ReturnToPrevious.test.tsx index 8ff6c986e85..0f9b5d62c94 100644 --- a/public/app/core/components/AppChrome/ReturnToPrevious/ReturnToPrevious.test.tsx +++ b/public/app/core/components/AppChrome/ReturnToPrevious/ReturnToPrevious.test.tsx @@ -59,11 +59,11 @@ describe('ReturnToPrevious', () => { /* The report is called 'grafana_return_to_previous_button_dismissed' but the action is 'clicked' */ const mockReturn = mockCalls.filter((call) => call[0] === 'grafana_return_to_previous_button_dismissed'); expect(mockReturn).toHaveLength(1); + expect(mockReturn[0][1]).toEqual({ action: 'clicked', page: '/dashboards' }); }); it('should trigger event once when clicking on the Close button', async () => { setup(); - const closeBtn = await screen.findByRole('button', { name: 'Close' }); expect(closeBtn).toBeInTheDocument(); await userEvent.click(closeBtn); @@ -71,5 +71,6 @@ describe('ReturnToPrevious', () => { /* The report is called 'grafana_return_to_previous_button_dismissed' but the action is 'dismissed' */ const mockDismissed = mockCalls.filter((call) => call[0] === 'grafana_return_to_previous_button_dismissed'); expect(mockDismissed).toHaveLength(1); + expect(mockDismissed[0][1]).toEqual({ action: 'dismissed', page: '/dashboards' }); }); });