/**
* @file Tests for ChargingStationWorkerBroadcastChannel
- * @description Verifies OCPP 2.0.1 UIService pipeline integration: enums, mappings,
+ * @description Verifies OCPP 2.0.1 UIService pipeline integration: mappings,
* response status logic, payload building, and handler routing for the 8 new broadcast
- * channel procedures. 59 tests across 7 groups.
+ * channel procedures.
*/
import assert from 'node:assert/strict'
})
// ==========================================================================
- // Group 1: ProcedureName enum — 8 new OCPP 2.0.1 entries (8 tests)
- // ==========================================================================
-
- await describe('ProcedureName enum OCPP 2.0.1 entries', async () => {
- await it('should have GET_15118_EV_CERTIFICATE in ProcedureName enum', () => {
- assert.strictEqual(ProcedureName.GET_15118_EV_CERTIFICATE, 'get15118EVCertificate')
- })
-
- await it('should have GET_CERTIFICATE_STATUS in ProcedureName enum', () => {
- assert.strictEqual(ProcedureName.GET_CERTIFICATE_STATUS, 'getCertificateStatus')
- })
-
- await it('should have LOG_STATUS_NOTIFICATION in ProcedureName enum', () => {
- assert.strictEqual(ProcedureName.LOG_STATUS_NOTIFICATION, 'logStatusNotification')
- })
-
- await it('should have NOTIFY_CUSTOMER_INFORMATION in ProcedureName enum', () => {
- assert.strictEqual(ProcedureName.NOTIFY_CUSTOMER_INFORMATION, 'notifyCustomerInformation')
- })
-
- await it('should have NOTIFY_REPORT in ProcedureName enum', () => {
- assert.strictEqual(ProcedureName.NOTIFY_REPORT, 'notifyReport')
- })
-
- await it('should have SECURITY_EVENT_NOTIFICATION in ProcedureName enum', () => {
- assert.strictEqual(ProcedureName.SECURITY_EVENT_NOTIFICATION, 'securityEventNotification')
- })
-
- await it('should have SIGN_CERTIFICATE in ProcedureName enum', () => {
- assert.strictEqual(ProcedureName.SIGN_CERTIFICATE, 'signCertificate')
- })
-
- await it('should have TRANSACTION_EVENT in ProcedureName enum', () => {
- assert.strictEqual(ProcedureName.TRANSACTION_EVENT, 'transactionEvent')
- })
- })
-
- // ==========================================================================
- // Group 2: BroadcastChannelProcedureName enum — 8 new OCPP 2.0.1 entries (8 tests)
- // ==========================================================================
-
- await describe('BroadcastChannelProcedureName enum OCPP 2.0.1 entries', async () => {
- await it('should have GET_15118_EV_CERTIFICATE in BroadcastChannelProcedureName enum', () => {
- assert.strictEqual(
- BroadcastChannelProcedureName.GET_15118_EV_CERTIFICATE,
- 'get15118EVCertificate'
- )
- })
-
- await it('should have GET_CERTIFICATE_STATUS in BroadcastChannelProcedureName enum', () => {
- assert.strictEqual(
- BroadcastChannelProcedureName.GET_CERTIFICATE_STATUS,
- 'getCertificateStatus'
- )
- })
-
- await it('should have LOG_STATUS_NOTIFICATION in BroadcastChannelProcedureName enum', () => {
- assert.strictEqual(
- BroadcastChannelProcedureName.LOG_STATUS_NOTIFICATION,
- 'logStatusNotification'
- )
- })
-
- await it('should have NOTIFY_CUSTOMER_INFORMATION in BroadcastChannelProcedureName enum', () => {
- assert.strictEqual(
- BroadcastChannelProcedureName.NOTIFY_CUSTOMER_INFORMATION,
- 'notifyCustomerInformation'
- )
- })
-
- await it('should have NOTIFY_REPORT in BroadcastChannelProcedureName enum', () => {
- assert.strictEqual(BroadcastChannelProcedureName.NOTIFY_REPORT, 'notifyReport')
- })
-
- await it('should have SECURITY_EVENT_NOTIFICATION in BroadcastChannelProcedureName enum', () => {
- assert.strictEqual(
- BroadcastChannelProcedureName.SECURITY_EVENT_NOTIFICATION,
- 'securityEventNotification'
- )
- })
-
- await it('should have SIGN_CERTIFICATE in BroadcastChannelProcedureName enum', () => {
- assert.strictEqual(BroadcastChannelProcedureName.SIGN_CERTIFICATE, 'signCertificate')
- })
-
- await it('should have TRANSACTION_EVENT in BroadcastChannelProcedureName enum', () => {
- assert.strictEqual(BroadcastChannelProcedureName.TRANSACTION_EVENT, 'transactionEvent')
- })
- })
-
- // ==========================================================================
- // Group 3: ProcedureNameToBroadCastChannelProcedureNameMapping — 8 new entries (8 tests)
+ // Group 1: ProcedureNameToBroadCastChannelProcedureNameMapping — 8 new entries (8 tests)
// ==========================================================================
await describe('ProcedureNameToBroadCastChannelProcedureNameMapping OCPP 2.0.1 entries', async () => {
})
// ==========================================================================
- // Group 4: commandResponseToResponseStatus — 4 new command response cases (18 tests)
+ // Group 2: commandResponseToResponseStatus — 4 new command response cases (18 tests)
// ==========================================================================
await describe('commandResponseToResponseStatus OCPP 2.0.1 commands', async () => {
})
// ==========================================================================
- // Group 5: buildRequestPayload — OCPP 2.0.1 certificate passthrough (3 tests)
+ // Group 3: buildRequestPayload — OCPP 2.0.1 certificate passthrough (3 tests)
// ==========================================================================
await describe('buildRequestPayload OCPP 2.0.1 certificate passthrough', async () => {
})
// ==========================================================================
- // Group 6: commandHandler dispatch pipeline — verify full dispatch (8 tests)
+ // Group 4: commandHandler dispatch pipeline — verify full dispatch (8 tests)
// ==========================================================================
await describe('commandHandler OCPP 2.0.1 dispatch pipeline', async () => {
})
// ==========================================================================
- // Group 7: requestHandler full pipeline — exercise handler dispatch via message events (6 tests)
+ // Group 5: requestHandler full pipeline — exercise handler dispatch via message events (6 tests)
// ==========================================================================
await describe('requestHandler full pipeline OCPP 2.0.1', async () => {
import {
AuthContext,
AuthenticationError,
- AuthenticationMethod,
AuthErrorCode,
AuthorizationStatus,
IdentifierType,
assert.strictEqual(identifier.certificateHashData?.hashAlgorithm, 'SHA256')
})
})
-
- await describe('Enums', async () => {
- await it('should have correct AuthContext values', () => {
- assert.strictEqual(AuthContext.TRANSACTION_START, 'TransactionStart')
- assert.strictEqual(AuthContext.TRANSACTION_STOP, 'TransactionStop')
- assert.strictEqual(AuthContext.REMOTE_START, 'RemoteStart')
- assert.strictEqual(AuthContext.REMOTE_STOP, 'RemoteStop')
- assert.strictEqual(AuthContext.RESERVATION, 'Reservation')
- assert.strictEqual(AuthContext.UNLOCK_CONNECTOR, 'UnlockConnector')
- })
-
- await it('should have correct AuthenticationMethod values', () => {
- assert.strictEqual(AuthenticationMethod.LOCAL_LIST, 'LocalList')
- assert.strictEqual(AuthenticationMethod.REMOTE_AUTHORIZATION, 'RemoteAuthorization')
- assert.strictEqual(AuthenticationMethod.CACHE, 'Cache')
- assert.strictEqual(AuthenticationMethod.CERTIFICATE_BASED, 'CertificateBased')
- assert.strictEqual(AuthenticationMethod.OFFLINE_FALLBACK, 'OfflineFallback')
- })
-
- await it('should have correct AuthorizationStatus values', () => {
- assert.strictEqual(AuthorizationStatus.ACCEPTED, 'Accepted')
- assert.strictEqual(AuthorizationStatus.BLOCKED, 'Blocked')
- assert.strictEqual(AuthorizationStatus.EXPIRED, 'Expired')
- assert.strictEqual(AuthorizationStatus.INVALID, 'Invalid')
- assert.strictEqual(AuthorizationStatus.CONCURRENT_TX, 'ConcurrentTx')
- })
-
- await it('should have correct IdentifierType values', () => {
- assert.strictEqual(IdentifierType.ID_TAG, 'IdTag')
- assert.strictEqual(IdentifierType.CENTRAL, 'Central')
- assert.strictEqual(IdentifierType.LOCAL, 'Local')
- assert.strictEqual(IdentifierType.E_MAID, 'eMAID')
- assert.strictEqual(IdentifierType.KEY_CODE, 'KeyCode')
- })
- })
})
+++ /dev/null
-/**
- * @file Tests for ConfigurationData
- * @description Unit tests for configuration data types and enumerations
- */
-import assert from 'node:assert/strict'
-import { afterEach, describe, it } from 'node:test'
-
-import {
- ApplicationProtocolVersion,
- ConfigurationSection,
- SupervisionUrlDistribution,
-} from '../../src/types/ConfigurationData.js'
-import { standardCleanup } from '../helpers/TestLifecycleHelpers.js'
-
-await describe('ConfigurationData', async () => {
- afterEach(() => {
- standardCleanup()
- })
-
- await it('should define ConfigurationSection enumeration values', () => {
- assert.strictEqual(ConfigurationSection.log, 'log')
- assert.strictEqual(ConfigurationSection.performanceStorage, 'performanceStorage')
- assert.strictEqual(ConfigurationSection.uiServer, 'uiServer')
- assert.strictEqual(ConfigurationSection.worker, 'worker')
- })
-
- await it('should define SupervisionUrlDistribution enumeration values', () => {
- assert.strictEqual(
- SupervisionUrlDistribution.CHARGING_STATION_AFFINITY,
- 'charging-station-affinity'
- )
- assert.strictEqual(SupervisionUrlDistribution.RANDOM, 'random')
- assert.strictEqual(SupervisionUrlDistribution.ROUND_ROBIN, 'round-robin')
- })
-
- await it('should define ApplicationProtocolVersion enumeration values', () => {
- assert.strictEqual(ApplicationProtocolVersion.VERSION_11, '1.1')
- assert.strictEqual(ApplicationProtocolVersion.VERSION_20, '2.0')
- })
-})