From 5cd05d92ca64dbeea06b5ff6d7adc35e0a7da431 Mon Sep 17 00:00:00 2001 From: Ryan Vazquez Date: Fri, 7 May 2021 14:52:55 -0400 Subject: [PATCH] update tests Signed-off-by: Ryan Vazquez --- .../ActionItems/ActionItemCard.test.tsx | 18 ++++++++++++++++++ .../AlertInsightsSection.test.tsx | 19 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/plugins/cost-insights/src/components/ActionItems/ActionItemCard.test.tsx b/plugins/cost-insights/src/components/ActionItems/ActionItemCard.test.tsx index 70ae44bcdc..b686076e17 100644 --- a/plugins/cost-insights/src/components/ActionItems/ActionItemCard.test.tsx +++ b/plugins/cost-insights/src/components/ActionItems/ActionItemCard.test.tsx @@ -43,4 +43,22 @@ describe('', () => { expect(rendered.getByText(alert.title)).toBeInTheDocument(); expect(rendered.getByText(alert.subtitle)).toBeInTheDocument(); }); + + it('renders custom title elements', async () => { + const rendered = await renderInTestApp( + + Foo, + subtitle: Bar, + }} + avatar={
1
} + /> +
, + ); + + expect(rendered.getByText('Foo')).toBeInTheDocument(); + expect(rendered.getByText('Bar')).toBeInTheDocument(); + }); }); diff --git a/plugins/cost-insights/src/components/AlertInsights/AlertInsightsSection.test.tsx b/plugins/cost-insights/src/components/AlertInsights/AlertInsightsSection.test.tsx index a651556303..f9fe985e43 100644 --- a/plugins/cost-insights/src/components/AlertInsights/AlertInsightsSection.test.tsx +++ b/plugins/cost-insights/src/components/AlertInsights/AlertInsightsSection.test.tsx @@ -49,6 +49,25 @@ describe('', () => { expect(queryByText('Dismiss')).not.toBeInTheDocument(); }); + it('renders custom title elements', () => { + const { getByText } = renderInContext( + Foo, + subtitle: Bar, + }} + number={1} + onSnooze={jest.fn()} + onDismiss={jest.fn()} + onAccept={jest.fn()} + />, + ); + + expect(getByText('Foo')).toBeInTheDocument(); + expect(getByText('Bar')).toBeInTheDocument(); + }); + it('Hides instructions button if url is not provided', () => { const alert: Alert = { ...mockAlert,