File tree Expand file tree Collapse file tree
src/server/plugins/engine/routes Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { getPaymentContext } from '~/src/server/plugins/engine/routes/payment-helper.js'
1+ import {
2+ buildPaymentInfo ,
3+ getPaymentContext
4+ } from '~/src/server/plugins/engine/routes/payment-helper.js'
25import { get } from '~/src/server/services/httpService.js'
36
47jest . mock ( '~/src/server/services/httpService.ts' )
@@ -83,6 +86,46 @@ describe('payment helper', () => {
8386 sessionKey : 'payment-5a54c2fe-da49-4202-8cd3-2121eaca03c3'
8487 } )
8588 } )
89+
90+ it ( 'should create logging info for a test payment' , ( ) => {
91+ const res = buildPaymentInfo (
92+ 'action1' ,
93+ 'outcome1' ,
94+ 'reason1' ,
95+ false ,
96+ 'pay-123'
97+ )
98+ expect ( res ) . toEqual ( {
99+ event : {
100+ category : 'payment' ,
101+ action : 'action1' ,
102+ outcome : 'outcome1' ,
103+ reason : 'reason1' ,
104+ type : 'test' ,
105+ reference : 'pay-123'
106+ }
107+ } )
108+ } )
109+
110+ it ( 'should create logging info for a live payment' , ( ) => {
111+ const res = buildPaymentInfo (
112+ 'action2' ,
113+ 'outcome2' ,
114+ 'reason2' ,
115+ true ,
116+ 'pay-123'
117+ )
118+ expect ( res ) . toEqual ( {
119+ event : {
120+ category : 'payment' ,
121+ action : 'action2' ,
122+ outcome : 'outcome2' ,
123+ reason : 'reason2' ,
124+ type : 'live' ,
125+ reference : 'pay-123'
126+ }
127+ } )
128+ } )
86129} )
87130
88131/**
You can’t perform that action at this time.
0 commit comments