Skip to content

Commit 7124f56

Browse files
author
rtkay123
committed
tests: remove channels in logicservice
1 parent 4f328e8 commit 7124f56

File tree

1 file changed

+26
-41
lines changed

1 file changed

+26
-41
lines changed

__tests__/unit/logic.service.test.ts

Lines changed: 26 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ describe('TADProc Service', () => {
9494
it('should handle a successful transaction, incomplete.', async () => {
9595
const expectedReq = getMockTransaction();
9696

97-
const ruleResults: RuleResult[] = [{ result: true, id: '', cfg: '', subRuleRef: '', reason: '' }];
97+
const ruleResults: RuleResult[] = [{ id: '', cfg: '', subRuleRef: '', reason: '' }];
9898

9999
const networkMap = getMockNetworkMapWithMultipleChannels();
100100
const typologyResult: TypologyResult = {
@@ -107,12 +107,12 @@ describe('TADProc Service', () => {
107107

108108
await handleExecute({ transaction: expectedReq, networkMap: networkMap, typologyResult: typologyResult });
109109

110-
expect(server.handleResponse).toBeCalledTimes(0);
110+
expect(server.handleResponse).toHaveReturnedTimes(0);
111111
});
112112

113113
it('should handle a successful transaction, complete.', async () => {
114114
const expectedReq = getMockTransaction();
115-
const ruleResults: RuleResult[] = [{ result: true, id: '', cfg: '', subRuleRef: '', reason: '' }];
115+
const ruleResults: RuleResult[] = [{ id: '', cfg: '', subRuleRef: '', reason: '' }];
116116

117117
const networkMap = getMockNetworkMap();
118118
const typologyResult: TypologyResult = {
@@ -127,24 +127,17 @@ describe('TADProc Service', () => {
127127
const typologySpy = jest.spyOn(helpers, 'handleTypologies').mockImplementationOnce(() => {
128128
return Promise.resolve({
129129
review: false,
130-
channelResults: [
130+
typologyResult: [
131131
{
132-
result: 0,
133132
134133
cfg: '1.0',
135-
typologyResult: [
136-
{
137-
138-
cfg: '1.0',
139-
result: 50,
140-
workflow: { alertThreshold: 0 },
141-
review: true,
142-
prcgTm: 0,
143-
ruleResults: [
144-
{ id: '[email protected]', cfg: '1.0', result: true, reason: 'asdf', subRuleRef: '123' },
145-
{ id: '[email protected]', cfg: '1.0', result: true, subRuleRef: '04', reason: 'Thedebtoris50orolder' },
146-
],
147-
},
134+
result: 50,
135+
workflow: { alertThreshold: 0 },
136+
review: true,
137+
prcgTm: 0,
138+
ruleResults: [
139+
{ id: '[email protected]', cfg: '1.0', result: true, reason: 'asdf', subRuleRef: '123' },
140+
{ id: '[email protected]', cfg: '1.0', result: true, subRuleRef: '04', reason: 'Thedebtoris50orolder' },
148141
],
149142
},
150143
],
@@ -157,13 +150,13 @@ describe('TADProc Service', () => {
157150

158151
await handleExecute({ transaction: expectedReq, networkMap: networkMap, typologyResult: typologyResult });
159152

160-
expect(typologySpy).toBeCalledTimes(1);
161-
expect(responseSpy).toBeCalled();
153+
expect(typologySpy).toHaveBeenCalledTimes(1);
154+
expect(responseSpy).toHaveBeenCalled();
162155
});
163156

164157
it('should handle a successful transaction, with review.', async () => {
165158
const expectedReq = getMockTransaction();
166-
const ruleResults: RuleResult[] = [{ result: true, id: '', cfg: '', subRuleRef: '', reason: '' }];
159+
const ruleResults: RuleResult[] = [{ id: '', cfg: '', subRuleRef: '', reason: '' }];
167160

168161
const networkMap = getMockNetworkMap();
169162
const typologyResult: TypologyResult = {
@@ -178,25 +171,17 @@ describe('TADProc Service', () => {
178171
const typologySpy = jest.spyOn(helpers, 'handleTypologies').mockImplementationOnce(() => {
179172
return Promise.resolve({
180173
review: true,
181-
channelResults: [
174+
typologyResult: [
182175
{
183-
result: 0,
184176
185177
cfg: '1.0',
178+
result: 50,
179+
review: true,
180+
workflow: { alertThreshold: 0 },
186181
prcgTm: 0,
187-
typologyResult: [
188-
{
189-
190-
cfg: '1.0',
191-
result: 50,
192-
review: true,
193-
workflow: { alertThreshold: 0 },
194-
prcgTm: 0,
195-
ruleResults: [
196-
{ id: '[email protected]', cfg: '1.0', result: true, reason: 'asdf', subRuleRef: '123' },
197-
{ id: '[email protected]', cfg: '1.0', result: true, subRuleRef: '04', reason: 'Thedebtoris50orolder' },
198-
],
199-
},
182+
ruleResults: [
183+
{ id: '[email protected]', cfg: '1.0', result: true, reason: 'asdf', subRuleRef: '123' },
184+
{ id: '[email protected]', cfg: '1.0', result: true, subRuleRef: '04', reason: 'Thedebtoris50orolder' },
200185
],
201186
},
202187
],
@@ -209,13 +194,13 @@ describe('TADProc Service', () => {
209194

210195
await handleExecute({ transaction: expectedReq, networkMap: networkMap, typologyResult: typologyResult });
211196

212-
expect(typologySpy).toBeCalledTimes(1);
213-
expect(responseSpy).toBeCalled();
197+
expect(typologySpy).toHaveBeenCalledTimes(1);
198+
expect(responseSpy).toHaveBeenCalled();
214199
});
215200

216201
it('should handle a unsuccessful transaction, catch error.', async () => {
217202
const expectedReq = getMockTransaction();
218-
const ruleResults: RuleResult[] = [{ result: true, id: '', cfg: '', subRuleRef: '', reason: '' }];
203+
const ruleResults: RuleResult[] = [{ id: '', cfg: '', subRuleRef: '', reason: '' }];
219204

220205
const networkMap = getMockNetworkMap();
221206
const typologyResult: TypologyResult = {
@@ -238,8 +223,8 @@ describe('TADProc Service', () => {
238223

239224
await handleExecute({ transaction: expectedReq, networkMap: networkMap, typologyResult: typologyResult });
240225

241-
expect(typologySpy).toBeCalledTimes(1);
242-
expect(responseSpy).toBeCalledTimes(0);
226+
expect(typologySpy).toHaveBeenCalledTimes(1);
227+
expect(responseSpy).toHaveBeenCalledTimes(0);
243228
});
244229
});
245230
});

0 commit comments

Comments
 (0)