Skip to content

Commit

Permalink
fix(test): mock fulfillment.evaluate
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerald Baulig committed Oct 31, 2024
1 parent c4c7359 commit 4104a91
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ export class OrderingService
SOLUTION_NOT_FOUND: {
id: '',
code: 404,
message: 'Solution for {entity} {id} not found!',
message: 'Solution for {entity} {id} not found!',
}
};

Expand Down Expand Up @@ -1912,7 +1912,7 @@ export class OrderingService
r => {
r.items?.forEach(
fulfillment => {
const id = fulfillment.payload?.references?.[0]?.instance_id ?? fulfillment.status?.id
const id = fulfillment.payload?.references?.[0]?.instance_id ?? fulfillment.status?.id;
const order = response_map[id];
if (order && fulfillment.status?.code !== 200) {
order.status = fulfillment.status;
Expand Down Expand Up @@ -2464,7 +2464,7 @@ export class OrderingService
return item;
}
);

const created = valids?.length ? await this.fulfillment_service.create(
{
items: valids.map(item => item.payload),
Expand Down
15 changes: 15 additions & 0 deletions test/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,21 @@ export const rules = {
totalCount: 1,
operationStatus
}),
evaluate: (
call: any,
callback: (error: any, response: FulfillmentListResponse) => void,
) => callback(null, {
items: call.request.items.map(
(item: FulfillmentResponse) => ({
payload: item,
status: {
code: 200,
}
})
),
totalCount: 1,
operationStatus
}),
},
invoice: {
create: (
Expand Down

0 comments on commit 4104a91

Please sign in to comment.