From 57e8d47a1da8fa32770f77f817151972dee6c440 Mon Sep 17 00:00:00 2001 From: Conor Macpherson Date: Fri, 31 Mar 2023 15:53:25 -0400 Subject: [PATCH] Fix tests. --- .../self_hosted_expansion_modal/expansion_card.tsx | 2 +- .../self_hosted_expansion_modal/index.test.tsx | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/webapp/channels/src/components/self_hosted_expansion_modal/expansion_card.tsx b/webapp/channels/src/components/self_hosted_expansion_modal/expansion_card.tsx index 47ecfa49aa..caa3afb2d9 100644 --- a/webapp/channels/src/components/self_hosted_expansion_modal/expansion_card.tsx +++ b/webapp/channels/src/components/self_hosted_expansion_modal/expansion_card.tsx @@ -208,7 +208,7 @@ export default function SelfHostedExpansionCard(props: Props) {
void; @@ -131,9 +132,9 @@ jest.mock('utils/hosted_customer', () => { const productName = SelfHostedProducts.PROFESSIONAL; // Licensed expiry set as 3 months from the current date (rolls over to new years). -const licenseExpiry = new Date(); +let licenseExpiry = moment() const monthsUntilLicenseExpiry = 3; -licenseExpiry.setMonth(licenseExpiry.getMonth() + monthsUntilLicenseExpiry); +licenseExpiry = licenseExpiry.add(monthsUntilLicenseExpiry, 'months'); const initialState: DeepPartial = { views: { @@ -164,7 +165,7 @@ const initialState: DeepPartial = { license: { Sku: productName, Users: '50', - ExpiresAt: licenseExpiry.getTime().toString(), + ExpiresAt: licenseExpiry.valueOf().toString(), }, }, cloud: { @@ -362,7 +363,7 @@ describe('SelfHostedExpansionModal RHS Card', () => { const costAmount = document.getElementsByClassName('totalCostAmount')[0]; expect(costAmount).toBeInTheDocument(); - expect(costAmount.innerHTML).toContain('$' + expectedTotalCost); + expect(costAmount).toHaveTextContent('$' + expectedTotalCost); }); });