email - fix tests
MODIFY
src/assets/email/mjml-components/footer.mjml
src/assets/email/mjml-components/footer.mjml
-<mj-section padding-top="20px">
+<mj-section padding-top="20px" padding-bottom="20px">
<mj-column>
<mj-divider border-width="1px" border-color="#E0E0E0"></mj-divider>
<mj-text font-size="12px">
<p>{{i18n:common.footerText}}</p>
</mj-text>
- <mj-divider border-width="1px" border-color="#E0E0E0"></mj-divider>
<mj-image width="250px" href="{{openEmobilityWebSiteURL}}" src="{{openEMobilityPoweredByLogo}}"></mj-image>
</mj-column>
</mj-section>

MODIFY
test/api/EmailTest.ts
test/api/EmailTest.ts
@@ -2,6 +2,7 @@ import { AccountVerificationNotification, AdminAccountVerificationNotification,
import User, { UserStatus } from '../../src/types/User';
import chai, { assert } from 'chai';
+import BrandingConstants from '../../src/utils/BrandingConstants';
import Constants from '../../src/utils/Constants';
import ContextDefinition from './context/ContextDefinition';
import ContextProvider from './context/ContextProvider';
@@ -63,8 +64,8 @@ describe('Initialization', () => {
const data = {
tenant: tenant.subdomain,
user,
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
- evseDashboardVerifyEmailURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardVerifyEmailURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
} as NewRegisteredUserNotification;
const notificationResult = await emailNotificationTask.sendNewRegisteredUser(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -75,7 +76,7 @@ describe('Initialization', () => {
it('request-password', async () => {
const data = {
user,
- evseDashboardResetPassURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardResetPassURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
evseDashboardURL: 'some_url2'
} as RequestPasswordNotification;
const notificationResult = await emailNotificationTask.sendRequestPassword(data, recipient, tenant, severity);
@@ -96,7 +97,7 @@ describe('Initialization', () => {
stateOfCharge: 89,
evseDashboardChargingStationURL: 'charging station url',
user,
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
} as OptimalChargeReachedNotification;
const notificationResult = await emailNotificationTask.sendOptimalChargeReached(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -115,9 +116,9 @@ describe('Initialization', () => {
totalConsumption: '48.3',
stateOfCharge: 1,
totalDuration: '5h14',
- evseDashboardChargingStationURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardChargingStationURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
user,
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
} as EndOfChargeNotification;
const notificationResult = await emailNotificationTask.sendEndOfCharge(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -140,7 +141,7 @@ describe('Initialization', () => {
tenant: tenant.subdomain,
user,
alternateUser: user,
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
evseDashboardChargingStationURL: 'charging station url',
} as EndOfSessionNotification;
const notificationResult = await emailNotificationTask.sendEndOfSession(data, recipient, tenant, severity);
@@ -151,11 +152,11 @@ describe('Initialization', () => {
it('billing-new-invoice-paid', async () => {
const data = {
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
- evseDashboardInvoiceURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardInvoiceURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
user,
- invoiceDownloadUrl: Constants.OPEN_EMOBILITY_WEBSITE_URL,
- payInvoiceUrl: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ invoiceDownloadUrl: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
+ payInvoiceUrl: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
invoiceNumber: 'I-2002-001',
invoiceAmount: '$12.50',
invoiceStatus: 'paid',
@@ -168,11 +169,11 @@ describe('Initialization', () => {
it('billing-new-invoice-unpaid', async () => {
const data = {
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
- evseDashboardInvoiceURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardInvoiceURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
user,
- invoiceDownloadUrl: Constants.OPEN_EMOBILITY_WEBSITE_URL,
- payInvoiceUrl: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ invoiceDownloadUrl: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
+ payInvoiceUrl: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
invoiceNumber: 'I-2002-001',
invoiceAmount: '$12.50',
invoiceStatus: 'unpaid',
@@ -189,8 +190,8 @@ describe('Initialization', () => {
siteID: 'Site 134',
siteAreaID: 'A3',
companyID: 'SAP12',
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
- evseDashboardChargingStationURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardChargingStationURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
} as ChargingStationRegisteredNotification;
const notificationResult = await emailNotificationTask.sendChargingStationRegistered(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -206,7 +207,7 @@ describe('Initialization', () => {
errorTitle: 'Session does not start',
errorDescription: 'I have not been able to start a session from my mobile phone',
phone: user.phone,
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
};
const notificationResult = await emailNotificationTask.sendEndUserErrorNotification(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -217,7 +218,7 @@ describe('Initialization', () => {
it('offline-charging-station', async () => {
const data: OfflineChargingStationNotification = {
chargingStationIDs: [ 'CS1', 'CS2', 'CS3', 'CS4', 'CS5', 'CS6', 'CS7', 'CS8', 'CS9', 'CS10', 'CS11', 'CS12' ],
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
};
const notificationResult = await emailNotificationTask.sendOfflineChargingStations(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -233,8 +234,8 @@ describe('Initialization', () => {
companyID: 'company id',
connectorId: 'connector id',
error: 'this is the error',
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
- evseDashboardChargingStationURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardChargingStationURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
};
const notificationResult = await emailNotificationTask.sendChargingStationStatusError(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -244,9 +245,9 @@ describe('Initialization', () => {
it('billing-account-created', async () => {
const data: BillingAccountCreationLinkNotification = {
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
user,
- onboardingLink: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ onboardingLink: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
};
const notificationResult = await emailNotificationTask.sendBillingAccountCreationLink(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -257,7 +258,7 @@ describe('Initialization', () => {
it('user-account-status-changed', async () => {
const data: UserAccountStatusChangedNotification = {
user,
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
};
const notificationResult = await emailNotificationTask.sendUserAccountStatusChanged(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -272,7 +273,7 @@ describe('Initialization', () => {
siteAreaID: 'site area id',
companyID: 'company id',
badgeID: 'badge id',
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
};
const notificationResult = await emailNotificationTask.sendUnknownUserBadged(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -289,8 +290,8 @@ describe('Initialization', () => {
companyID: 'company id',
chargeBoxID: 'charge box id',
connectorId: 'connector id',
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
- evseDashboardChargingStationURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardChargingStationURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
};
const notificationResult = await emailNotificationTask.sendSessionStarted(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -301,8 +302,8 @@ describe('Initialization', () => {
it('verification-email', async () => {
const data: VerificationEmailNotification = {
user,
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
- evseDashboardVerifyEmailURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardVerifyEmailURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
};
const notificationResult = await emailNotificationTask.sendVerificationEmail(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -313,8 +314,8 @@ describe('Initialization', () => {
it('verification-email-user-import', async () => {
const data: VerificationEmailNotification = {
user,
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
- evseDashboardVerifyEmailURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardVerifyEmailURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
};
const notificationResult = await emailNotificationTask.sendVerificationEmailUserImport(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -324,7 +325,7 @@ describe('Initialization', () => {
it('ocpi-patch-status-error', async () => {
const data: OCPIPatchChargingStationsStatusesErrorNotification = {
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
location: 'location'
};
const notificationResult = await emailNotificationTask.sendOCPIPatchChargingStationsStatusesError(data, recipient, tenant, severity);
@@ -335,7 +336,7 @@ describe('Initialization', () => {
it('oicp-patch-status-error', async () => {
const data: OICPPatchChargingStationsStatusesErrorNotification = {
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL
};
const notificationResult = await emailNotificationTask.sendOICPPatchChargingStationsStatusesError(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -345,7 +346,7 @@ describe('Initialization', () => {
it('oicp-patch-evses-error', async () => {
const data: OICPPatchChargingStationsErrorNotification = {
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
};
const notificationResult = await emailNotificationTask.sendOICPPatchChargingStationsError(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -357,7 +358,7 @@ describe('Initialization', () => {
const data: UserAccountInactivityNotification = {
user,
lastLogin: new Date().toDateString(),
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
};
const notificationResult = await emailNotificationTask.sendUserAccountInactivity(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -374,8 +375,8 @@ describe('Initialization', () => {
companyID: 'company id',
connectorId: 'connector id',
startedOn: 'started on',
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
- evseDashboardChargingStationURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardChargingStationURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
} as PreparingSessionNotStartedNotification;
const notificationResult = await emailNotificationTask.sendPreparingSessionNotStarted(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -390,8 +391,8 @@ describe('Initialization', () => {
siteAreaID: 'site area id',
companyID: 'company id',
user,
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
- evseDashboardChargingStationURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardChargingStationURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
} as SessionNotStartedNotification;
const notificationResult = await emailNotificationTask.sendSessionNotStarted(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -402,8 +403,8 @@ describe('Initialization', () => {
it('billing-user-synchronization-failed', async () => {
const data: BillingUserSynchronizationFailedNotification = {
nbrUsersInError: 123,
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
- evseDashboardBillingURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardBillingURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
};
const notificationResult = await emailNotificationTask.sendBillingSynchronizationFailed(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -414,8 +415,8 @@ describe('Initialization', () => {
it('billing-invoice-synchronization-failed', async () => {
const data: BillingInvoiceSynchronizationFailedNotification = {
nbrInvoicesInError: 123,
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
- evseDashboardBillingURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardBillingURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
};
const notificationResult = await emailNotificationTask.sendBillingInvoiceSynchronizationFailed(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -426,8 +427,8 @@ describe('Initialization', () => {
it('billing-periodic-operation-failed', async () => {
const data: BillingPeriodicOperationFailedNotification = {
nbrInvoicesInError: 123,
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
- evseDashboardBillingURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardBillingURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
};
const notificationResult = await emailNotificationTask.sendBillingPeriodicOperationFailed(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -437,7 +438,7 @@ describe('Initialization', () => {
it('billing-account-activated', async () => {
const data: BillingAccountActivationNotification = {
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
user,
};
const notificationResult = await emailNotificationTask.sendBillingAccountActivationNotification(data, recipient, tenant, severity);
@@ -449,7 +450,7 @@ describe('Initialization', () => {
it('car-synchronization-failed', async () => {
const data: CarCatalogSynchronizationFailedNotification = {
nbrCarsInError: 10,
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
};
const notificationResult = await emailNotificationTask.sendCarCatalogSynchronizationFailed(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -464,7 +465,7 @@ describe('Initialization', () => {
siteID: 'site id',
siteAreaID: 'site area id',
companyID: 'company id',
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
} as ComputeAndApplyChargingProfilesFailedNotification;
const notificationResult = await emailNotificationTask.sendComputeAndApplyChargingProfilesFailed(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -476,7 +477,7 @@ describe('Initialization', () => {
const data: AccountVerificationNotification = {
user,
userStatus: UserStatus.ACTIVE,
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
};
const notificationResult = await emailNotificationTask.sendAccountVerificationNotification(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -488,7 +489,7 @@ describe('Initialization', () => {
const data: AccountVerificationNotification = {
user,
userStatus: UserStatus.INACTIVE,
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
};
const notificationResult = await emailNotificationTask.sendAccountVerificationNotification(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -499,8 +500,8 @@ describe('Initialization', () => {
it('admin-account-verification-notification', async () => {
const data: AdminAccountVerificationNotification = {
user,
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
- evseUserToVerifyURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseUserToVerifyURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
};
const notificationResult = await emailNotificationTask.sendAdminAccountVerificationNotification(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);
@@ -512,8 +513,8 @@ describe('Initialization', () => {
const data: UserCreatePassword = {
user,
tenantName: tenant.name,
- evseDashboardURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
- evseDashboardCreatePasswordURL: Constants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
+ evseDashboardCreatePasswordURL: BrandingConstants.OPEN_EMOBILITY_WEBSITE_URL,
};
const notificationResult = await emailNotificationTask.sendUserCreatePassword(data, recipient, tenant, severity);
const isMissing = checkForMissing(notificationResult.html);

email - fix tests