Skip to content

Commit b26324a

Browse files
committed
Extra coverage
1 parent ecd5c73 commit b26324a

1 file changed

Lines changed: 44 additions & 1 deletion

File tree

src/server/plugins/engine/routes/payment-helper.test.js

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
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'
25
import { get } from '~/src/server/services/httpService.js'
36

47
jest.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
/**

0 commit comments

Comments
 (0)