diff --git a/projects/aas-server/src/test/packages/opcua/opcua-reader.spec.ts b/projects/aas-server/src/test/packages/opcua/opcua-reader.spec.ts index 0b964b51..2ac33356 100644 --- a/projects/aas-server/src/test/packages/opcua/opcua-reader.spec.ts +++ b/projects/aas-server/src/test/packages/opcua/opcua-reader.spec.ts @@ -7,26 +7,26 @@ *****************************************************************************/ import { describe, beforeEach, it, expect, jest } from '@jest/globals'; +import { createSpyObj } from 'fhg-jest'; import { Logger } from '../../../app/logging/logger.js'; import { OpcuaReader } from '../../../app/packages/opcua/opcua-reader.js'; import { OPCUAComponent } from '../../../app/packages/opcua/opcua.js'; import { OpcuaDataTypeDictionary } from '../../../app/packages/opcua/opcua-data-type-dictionary.js'; -import { createSpyObj } from 'fhg-jest'; -describe('OpcuaReader', function () { +describe('OpcuaReader', () => { let reader: OpcuaReader; let logger: jest.Mocked; let origin: jest.Mocked; let dataTypes: jest.Mocked; - beforeEach(function () { + beforeEach(() => { logger = createSpyObj(['error', 'warning', 'info', 'debug', 'start', 'stop']); origin = createSpyObj({}, ['displayName', 'hasProperty', 'nodeClass']); dataTypes = createSpyObj(['get']); reader = new OpcuaReader(logger, origin, dataTypes); }); - it('should be created', function () { + it('should be created', () => { expect(reader).toBeTruthy(); }); }); diff --git a/projects/fhg-jest/src/lib/create-spy-obj.ts b/projects/fhg-jest/src/lib/create-spy-obj.ts index b8c837f5..ae976fe3 100644 --- a/projects/fhg-jest/src/lib/create-spy-obj.ts +++ b/projects/fhg-jest/src/lib/create-spy-obj.ts @@ -28,7 +28,9 @@ export function createSpyObj( if (propertyNames) { if (Array.isArray(propertyNames)) { - throw new Error('Not implemented.'); + for (const propertyName of propertyNames) { + obj[propertyName] = propertyNames[propertyName]; + } } else { for (const propertyName in propertyNames) { obj[propertyName] = propertyNames[propertyName];