@labdigital/commercetools-mock 2.30.0 → 2.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/repositories/order/actions.ts +9 -0
- package/src/services/order.test.ts +14 -0
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
OrderAddReturnInfoAction,
|
|
7
7
|
OrderChangeOrderStateAction,
|
|
8
8
|
OrderChangePaymentStateAction,
|
|
9
|
+
OrderChangeShipmentStateAction,
|
|
9
10
|
OrderSetBillingAddressAction,
|
|
10
11
|
OrderSetCustomFieldAction,
|
|
11
12
|
OrderSetCustomTypeAction,
|
|
@@ -117,6 +118,14 @@ export class OrderUpdateHandler
|
|
|
117
118
|
resource.paymentState = paymentState;
|
|
118
119
|
}
|
|
119
120
|
|
|
121
|
+
changeShipmentState(
|
|
122
|
+
context: RepositoryContext,
|
|
123
|
+
resource: Writable<Order>,
|
|
124
|
+
{ shipmentState }: OrderChangeShipmentStateAction,
|
|
125
|
+
) {
|
|
126
|
+
resource.shipmentState = shipmentState;
|
|
127
|
+
}
|
|
128
|
+
|
|
120
129
|
setBillingAddress(
|
|
121
130
|
context: RepositoryContext,
|
|
122
131
|
resource: Writable<Order>,
|
|
@@ -403,6 +403,20 @@ describe("Order Update Actions", () => {
|
|
|
403
403
|
expect(response.body.paymentState).toBe("Failed");
|
|
404
404
|
});
|
|
405
405
|
|
|
406
|
+
test("changeShipmentState", async () => {
|
|
407
|
+
assert(order, "order not created");
|
|
408
|
+
|
|
409
|
+
const response = await supertest(ctMock.app)
|
|
410
|
+
.post(`/dummy/orders/${order.id}`)
|
|
411
|
+
.send({
|
|
412
|
+
version: 1,
|
|
413
|
+
actions: [{ action: "changeShipmentState", shipmentState: "Delayed" }],
|
|
414
|
+
});
|
|
415
|
+
expect(response.status).toBe(200);
|
|
416
|
+
expect(response.body.version).toBe(2);
|
|
417
|
+
expect(response.body.shipmentState).toBe("Delayed");
|
|
418
|
+
});
|
|
419
|
+
|
|
406
420
|
test("setDeliveryCustomField", async () => {
|
|
407
421
|
const order: Order = {
|
|
408
422
|
...getBaseResourceProperties(),
|