Skip to content

Commit 4104a91

Browse files
author
Gerald Baulig
committed
fix(test): mock fulfillment.evaluate
1 parent c4c7359 commit 4104a91

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/service.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ export class OrderingService
360360
SOLUTION_NOT_FOUND: {
361361
id: '',
362362
code: 404,
363-
message: 'Solution for {entity} {id} not found!',
363+
message: 'Solution for {entity} {id} not found!',
364364
}
365365
};
366366

@@ -1912,7 +1912,7 @@ export class OrderingService
19121912
r => {
19131913
r.items?.forEach(
19141914
fulfillment => {
1915-
const id = fulfillment.payload?.references?.[0]?.instance_id ?? fulfillment.status?.id
1915+
const id = fulfillment.payload?.references?.[0]?.instance_id ?? fulfillment.status?.id;
19161916
const order = response_map[id];
19171917
if (order && fulfillment.status?.code !== 200) {
19181918
order.status = fulfillment.status;
@@ -2464,7 +2464,7 @@ export class OrderingService
24642464
return item;
24652465
}
24662466
);
2467-
2467+
24682468
const created = valids?.length ? await this.fulfillment_service.create(
24692469
{
24702470
items: valids.map(item => item.payload),

test/mocks.ts

+15
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,21 @@ export const rules = {
10901090
totalCount: 1,
10911091
operationStatus
10921092
}),
1093+
evaluate: (
1094+
call: any,
1095+
callback: (error: any, response: FulfillmentListResponse) => void,
1096+
) => callback(null, {
1097+
items: call.request.items.map(
1098+
(item: FulfillmentResponse) => ({
1099+
payload: item,
1100+
status: {
1101+
code: 200,
1102+
}
1103+
})
1104+
),
1105+
totalCount: 1,
1106+
operationStatus
1107+
}),
10931108
},
10941109
invoice: {
10951110
create: (

0 commit comments

Comments
 (0)