From eb40f3207a087812bfa649a24f264562f494758e Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Mon, 19 Dec 2022 13:43:53 +0000 Subject: [PATCH] fix unit tests --- .../SpanDetail/AccordianKeyValues.test.tsx | 4 +--- public/app/core/components/NavBar/NavBarItem.test.tsx | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/jaeger-ui-components/src/TraceTimelineViewer/SpanDetail/AccordianKeyValues.test.tsx b/packages/jaeger-ui-components/src/TraceTimelineViewer/SpanDetail/AccordianKeyValues.test.tsx index 06c6c8f1d2d..58c63750c98 100644 --- a/packages/jaeger-ui-components/src/TraceTimelineViewer/SpanDetail/AccordianKeyValues.test.tsx +++ b/packages/jaeger-ui-components/src/TraceTimelineViewer/SpanDetail/AccordianKeyValues.test.tsx @@ -97,9 +97,7 @@ describe('AccordianKeyValues test', () => { it('renders the summary instead of the table when it is not expanded', () => { setupAccordian({ isOpen: false } as AccordianKeyValuesProps); - expect( - screen.getByRole('switch', { name: 'test accordian: span.kind = client omg = mos-def' }) - ).toBeInTheDocument(); + expect(screen.getByRole('switch', { name: 'test accordian: span.kind = clientomg = mos-def' })).toBeInTheDocument(); expect(screen.queryByRole('table')).not.toBeInTheDocument(); expect(screen.queryAllByRole('cell')).toHaveLength(0); }); diff --git a/public/app/core/components/NavBar/NavBarItem.test.tsx b/public/app/core/components/NavBar/NavBarItem.test.tsx index 86b0eca5fae..3f4fbf83597 100644 --- a/public/app/core/components/NavBar/NavBarItem.test.tsx +++ b/public/app/core/components/NavBar/NavBarItem.test.tsx @@ -196,9 +196,9 @@ describe('NavBarItem', () => { expect(screen.getAllByRole('menuitem')[2]).toHaveAttribute('tabIndex', '-1'); await userEvent.keyboard('{ArrowLeft}'); - expect(screen.getAllByRole('link')[0]).toHaveFocus(); + expect((await screen.findAllByRole('link'))[0]).toHaveFocus(); expect(screen.getAllByRole('menuitem')).toHaveLength(3); - expect(screen.getAllByRole('menuitem')[0]).toHaveAttribute('tabIndex', '-1'); + expect(screen.getAllByRole('menuitem')[1]).toHaveAttribute('tabIndex', '-1'); expect(screen.getAllByRole('menuitem')[1]).toHaveAttribute('tabIndex', '-1'); expect(screen.getAllByRole('menuitem')[2]).toHaveAttribute('tabIndex', '-1'); });