1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-26 09:33:22 +00:00

Fix the untest errors

This commit is contained in:
Cy Okeke
2025-06-18 12:38:36 +01:00
parent 0118ada270
commit 5c6e280c00
2 changed files with 8 additions and 6 deletions

View File

@@ -58,7 +58,7 @@ export class PricingCalculationService {
if (selectedPlan.productTier === ProductTierType.Families) {
return selectedPlan.PasswordManager.baseSeats;
}
return subscription?.seats;
return subscription?.seats ?? 0;
}
calculateTotal(

View File

@@ -79,7 +79,7 @@ export class TrialPaymentMethodService {
passwordManager: {
additionalStorage: 0,
plan: selectedPlan?.type,
seats: subscription.seats,
seats: subscription.seats ?? 0,
},
taxInformation: {
postalCode: taxInformation.postalCode,
@@ -90,9 +90,10 @@ export class TrialPaymentMethodService {
if (organization.useSecretsManager) {
request.secretsManager = {
seats: subscription.smSeats,
seats: subscription.smSeats ?? 0,
additionalMachineAccounts:
subscription.smServiceAccounts - subscription.plan.SecretsManager.baseServiceAccount,
(subscription.smServiceAccounts ?? 0) -
(subscription.plan?.SecretsManager?.baseServiceAccount ?? 0),
};
}
@@ -100,11 +101,12 @@ export class TrialPaymentMethodService {
const invoice = await taxService.previewOrganizationInvoice(request);
return invoice.taxAmount;
} catch (error) {
const translatedMessage = i18nService.t(error.message);
const errorMessage = error instanceof Error ? error.message : String(error);
const translatedMessage = i18nService.t(errorMessage);
toastService.showToast({
title: "",
variant: "error",
message: !translatedMessage || translatedMessage === "" ? error.message : translatedMessage,
message: !translatedMessage || translatedMessage === "" ? errorMessage : translatedMessage,
});
throw error;
}