@labdigital/commercetools-mock 2.49.0 → 2.49.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labdigital/commercetools-mock",
3
- "version": "2.49.0",
3
+ "version": "2.49.1",
4
4
  "license": "MIT",
5
5
  "author": "Michael van Tellingen",
6
6
  "type": "module",
@@ -781,7 +781,10 @@ export class CartUpdateHandler
781
781
  const shippingMethod =
782
782
  this._storage.getByResourceIdentifier<"shipping-method">(
783
783
  context.projectKey,
784
- { key: shippingKey } as ShippingMethodResourceIdentifier,
784
+ {
785
+ typeId: "shipping-method",
786
+ key: shippingKey,
787
+ } as ShippingMethodResourceIdentifier,
785
788
  );
786
789
 
787
790
  if (resource.shippingInfo?.shippingMethod?.id !== shippingMethod.id) {
@@ -1101,6 +1101,37 @@ describe("Cart Update Actions", () => {
1101
1101
  );
1102
1102
  });
1103
1103
 
1104
+ test("correctly removes a shipping method", async () => {
1105
+ assert(cart, "cart not created");
1106
+
1107
+ const shippingMethod: ShippingMethodResourceIdentifier = {
1108
+ typeId: "shipping-method",
1109
+ id: standardShippingMethod.id,
1110
+ };
1111
+
1112
+ const response = await supertest(ctMock.app)
1113
+ .post(`/dummy/carts/${cart.id}`)
1114
+ .send({
1115
+ version: 2,
1116
+ actions: [{ action: "setShippingMethod", shippingMethod }],
1117
+ });
1118
+ expect(response.status).toBe(200);
1119
+
1120
+ const removeResponse = await supertest(ctMock.app)
1121
+ .post(`/dummy/carts/${cart.id}`)
1122
+ .send({
1123
+ version: 3,
1124
+ actions: [
1125
+ {
1126
+ action: "removeShippingMethod",
1127
+ shippingKey: standardShippingMethod.key,
1128
+ },
1129
+ ],
1130
+ });
1131
+ expect(removeResponse.status).toBe(200);
1132
+ expect(removeResponse.body.shippingInfo).toBeUndefined();
1133
+ });
1134
+
1104
1135
  test("correctly sets shippingInfo rates + tax when includedInPrice: true", async () => {
1105
1136
  assert(cart, "cart not created");
1106
1137
  assert(standardShippingMethod, "shipping method not created");