@@ -144,23 +144,26 @@ describe("Notification Tests", function (): void {
144144
145145} ) ;
146146
147- describe ( 'NotificationRequestItem.additionalData' , ( ) => {
148- it ( 'handles undefined keys' , ( ) => {
149- const item : NotificationRequestItem = {
150- additionalData : {
151- existingKey : "abc" ,
152- undefinedKey : undefined
153- } ,
154- amount : { currency : "EUR" , value : 1000 } ,
155- pspReference : "" ,
156- eventCode : NotificationRequestItem . EventCodeEnum . Authorisation ,
157- eventDate : "" ,
158- merchantAccountCode : "" ,
159- merchantReference : "" ,
160- success : NotificationRequestItem . SuccessEnum . True
147+ describe ( "NotificationRequestItem.additionalData" , ( ) => {
148+
149+ it ( "handles undefined keys" , ( ) => {
150+ const item = new NotificationRequestItem ( ) ;
151+ item . additionalData = {
152+ existingKey : "abc" ,
153+ undefinedKey : undefined
161154 } ;
162- expect ( item . additionalData ?. [ 'existingKey' ] ) . toBeDefined ( ) ;
163- expect ( item . additionalData ?. [ 'undefinedKey' ] ) . toBeUndefined ( ) ;
164- expect ( item . additionalData ?. [ 'nonExistingKey' ] ) . toBeUndefined ( ) ;
155+ item . amount = { currency : "EUR" , value : 1000 } ;
156+ item . pspReference = "" ;
157+ item . eventCode = NotificationRequestItem . EventCodeEnum . Authorisation ;
158+ item . eventDate = "" ;
159+ item . merchantAccountCode = "" ;
160+ item . merchantReference = "" ;
161+ item . success = NotificationRequestItem . SuccessEnum . True ;
162+
163+ expect ( item . additionalData ) . toBeDefined ( ) ;
164+ expect ( item . additionalData ) . toHaveProperty ( "existingKey" , "abc" ) ;
165+ expect ( item . additionalData ) . toHaveProperty ( "undefinedKey" , undefined ) ;
166+ expect ( item . additionalData ) . not . toHaveProperty ( "nonExistingKey" ) ;
165167 } ) ;
168+
166169} ) ;
0 commit comments