Test if cps already applied are removed in smart charging
MODIFY
test/api/SmartChargingTest.ts
test/api/SmartChargingTest.ts
@@ -487,7 +487,28 @@ describe('Smart Charging Service', function() {
'limit': Utils.roundTo(20 * aCBufferFactor, 3)
}
]);
- await ChargingStationStorage.saveChargingProfile(testData.tenantContext.getTenant().id, chargingProfiles[2]);
+ // Do not save the last profile to check if this is the only one build in the upcoming test
+ });
+
+ it('Test if charging profiles are returned, when they are already applied', async () => {
+ const chargingProfiles = await smartChargingIntegration.buildChargingProfiles(testData.siteAreaContext.getSiteArea());
+ // Charging Profiles should be empty, they were already applied in the test before
+ TestData.validateChargingProfile(chargingProfiles[0], transaction2);
+ expect(chargingProfiles[0].profile.chargingSchedule.chargingSchedulePeriod).containSubset([
+ {
+ 'startPeriod': 0,
+ 'limit': Utils.roundTo(20 * aCBufferFactor, 3)
+ },
+ {
+ 'startPeriod': 900,
+ 'limit': Utils.roundTo(20 * aCBufferFactor, 3)
+ },
+ {
+ 'startPeriod': 1800,
+ 'limit': Utils.roundTo(20 * aCBufferFactor, 3)
+ }
+ ]);
+ await ChargingStationStorage.saveChargingProfile(testData.tenantContext.getTenant().id, chargingProfiles[0]);
});

Test if cps already applied are removed in smart charging