* between auth types and OCPP 2.0 specific types and protocols.
*/
export class OCPP20AuthAdapter implements OCPPAuthAdapter<OCPP20IdTokenType> {
- readonly ocppVersion = OCPPVersion.VERSION_20
+ readonly ocppVersion = OCPPVersion.VERSION_201
constructor (private readonly chargingStation: ChargingStation) {}
context: authContext,
identifier,
metadata: {
- ocppVersion: OCPPVersion.VERSION_20,
+ ocppVersion: OCPPVersion.VERSION_201,
stationId: this.chargingStation.stationInfo?.chargingStationId,
},
timestamp: new Date(),
await describe('constructor', async () => {
await it('should initialize with correct OCPP version', () => {
- assert.strictEqual(adapter.ocppVersion, OCPPVersion.VERSION_20)
+ assert.strictEqual(adapter.ocppVersion, OCPPVersion.VERSION_201)
})
})
assert.strictEqual(request.connectorId, 1)
assert.strictEqual(request.transactionId, 'trans_123')
assert.strictEqual(request.context, AuthContext.TRANSACTION_START)
- assert.strictEqual(request.metadata?.ocppVersion, OCPPVersion.VERSION_20)
+ assert.strictEqual(request.metadata?.ocppVersion, OCPPVersion.VERSION_201)
})
await it('should map OCPP 2.0 contexts correctly', () => {
await it('should return adapter status information', () => {
const status = adapter.getStatus()
- assert.strictEqual(status.ocppVersion, OCPPVersion.VERSION_20)
+ assert.strictEqual(status.ocppVersion, OCPPVersion.VERSION_201)
assert.strictEqual(status.isOnline, true)
assert.strictEqual(status.stationId, 'TEST-002')
assert.notStrictEqual(status.supportsIdTokenTypes, undefined)
await it('should have correct OCPP version for offline tests', () => {
// Verify we're testing the correct OCPP version
- assert.strictEqual(offlineAdapter.ocppVersion, OCPPVersion.VERSION_20)
+ assert.strictEqual(offlineAdapter.ocppVersion, OCPPVersion.VERSION_201)
})
})
await it('should initialize with default configuration for offline scenarios', () => {
// When: Adapter is created
// Then: Should have OCPP 2.0 version
- assert.strictEqual(offlineAdapter.ocppVersion, OCPPVersion.VERSION_20)
+ assert.strictEqual(offlineAdapter.ocppVersion, OCPPVersion.VERSION_201)
})
await it('should validate configuration schema for offline auth', () => {
// Then: Status should be defined and include online state
assert.notStrictEqual(status, undefined)
assert.strictEqual(typeof status.isOnline, 'boolean')
- assert.strictEqual(status.ocppVersion, OCPPVersion.VERSION_20)
+ assert.strictEqual(status.ocppVersion, OCPPVersion.VERSION_201)
})
})
})
const adapter = AuthComponentFactory.createAdapter(chargingStation)
assert.notStrictEqual(adapter, undefined)
- assert.strictEqual(adapter.ocppVersion, OCPPVersion.VERSION_20)
+ assert.strictEqual(adapter.ocppVersion, OCPPVersion.VERSION_201)
})
await it('should create OCPP 2.0.1 adapter', () => {
const adapter = AuthComponentFactory.createAdapter(chargingStation)
assert.notStrictEqual(adapter, undefined)
- assert.strictEqual(adapter.ocppVersion, OCPPVersion.VERSION_20)
+ assert.strictEqual(adapter.ocppVersion, OCPPVersion.VERSION_201)
})
await it('should throw error for unsupported version', () => {
logPrefix: () => '[TEST-CS-001]',
stationInfo: {
chargingStationId: 'TEST-CS-001',
- ocppVersion: OCPPVersion.VERSION_20,
+ ocppVersion: OCPPVersion.VERSION_201,
},
} as unknown as ChargingStation
- mockOCPP20Adapter = createMockOCPPAdapter(OCPPVersion.VERSION_20, {
+ mockOCPP20Adapter = createMockOCPPAdapter(OCPPVersion.VERSION_201, {
authorizeRemote: () =>
new Promise<AuthorizationResult>(resolve => {
resolve(