Skip to content

Commit

Permalink
fix(test): add mocks for invoice send
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerald Baulig committed Jan 7, 2025
1 parent 902f37d commit 0a10f84
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cfg/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
}
},
"invoice": {
"disabled": true,
"disabled": false,
"address": "localhost:50077",
"tech_user": {
"id": "root_tech_user",
Expand Down
2 changes: 1 addition & 1 deletion cfg/config_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
}
},
"invoice": {
"disabled": true,
"disabled": false,
"address": "localhost:50177",
"mock": {
"protoPath": "io/restorecommerce/invoice.proto",
Expand Down
2 changes: 0 additions & 2 deletions src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1844,7 +1844,6 @@ export class OrderingService

if (this.fulfillment_service) {
this.logger?.debug('Create fulfillment on submit...');
console.log(settings);
response.fulfillments = await this._createFulfillment(
{
items: response.orders?.filter(
Expand Down Expand Up @@ -2080,7 +2079,6 @@ export class OrderingService
);

response.orders = request.items.map(item => response_map[item.id]);
this.logger.error('test', response);
return response;
}
catch (e: any) {
Expand Down
14 changes: 13 additions & 1 deletion test/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ import {
FulfillmentResponse,
} from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/fulfillment.js';
import {
OperationStatus
OperationStatus,
StatusListResponse
} from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/status.js';
import {
InvoiceListResponse,
Expand Down Expand Up @@ -1159,6 +1160,17 @@ export const rules = {
}],
totalCount: 1,
operationStatus,
}),
send: (
call: any,
callback: (error: any, response: StatusListResponse) => void,
) => callback(null, {
status: [{
id: 'invoice_1',
code: 200,
message: 'OK',
}],
operationStatus,
})
},
};

0 comments on commit 0a10f84

Please sign in to comment.