@labdigital/commercetools-mock 1.9.0 → 1.10.0

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@labdigital/commercetools-mock",
3
3
  "author": "Michael van Tellingen",
4
- "version": "1.9.0",
4
+ "version": "1.10.0",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.js",
@@ -21,6 +21,7 @@ import type {
21
21
  Price,
22
22
  Product,
23
23
  ProductPagedQueryResponse,
24
+ CartRemoveDiscountCodeAction,
24
25
  ProductVariant,
25
26
  } from '@commercetools/platform-sdk'
26
27
  import { v4 as uuidv4 } from 'uuid'
@@ -415,6 +416,15 @@ export class CartRepository extends AbstractResourceRepository<'cart'> {
415
416
  custom: custom,
416
417
  }
417
418
  },
419
+ removeDiscountCode: (
420
+ context: RepositoryContext,
421
+ resource: Writable<Cart>,
422
+ { discountCode }: CartRemoveDiscountCodeAction
423
+ ) => {
424
+ resource.discountCodes = resource.discountCodes.filter(
425
+ (code) => code.discountCode.id !== discountCode.id
426
+ )
427
+ },
418
428
  }
419
429
  draftLineItemtoLineItem = (
420
430
  projectKey: string,
@@ -35,7 +35,7 @@ describe('Associate roles query', () => {
35
35
  expect(response.status).toBe(200)
36
36
  expect(response.body.count).toBe(1)
37
37
 
38
- const associateRole = response.body.results[0] as AssociateRole
38
+ associateRole = response.body.results[0] as AssociateRole
39
39
 
40
40
  expect(associateRole.key).toBe('example-role-associate-role')
41
41
  })
@@ -35,7 +35,7 @@ describe('Business units query', () => {
35
35
  expect(response.status).toBe(200)
36
36
  expect(response.body.count).toBe(1)
37
37
 
38
- const businessUnit = response.body.results[0] as BusinessUnit
38
+ businessUnit = response.body.results[0] as BusinessUnit
39
39
 
40
40
  expect(businessUnit.key).toBe('example-business-unit')
41
41
  })
@@ -42,7 +42,7 @@ describe('Categories Query', () => {
42
42
  expect(response.status).toBe(200)
43
43
  expect(response.body.count).toBe(1)
44
44
 
45
- const category = response.body.results[0] as Category
45
+ category = response.body.results[0] as Category
46
46
 
47
47
  expect(category.name.en).toBe('Top hat')
48
48
  })
@@ -27,6 +27,7 @@ export class CustomerService extends AbstractService {
27
27
  ? // @ts-ignore
28
28
  +request.params.ttlMinutes
29
29
  : 34560
30
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
30
31
  const { version, ...rest } = getBaseResourceProperties()
31
32
 
32
33
  return response.status(200).send({
@@ -163,7 +163,6 @@ describe('Product', () => {
163
163
  describe('Product update actions', () => {
164
164
  const ctMock = new CommercetoolsMock()
165
165
  let productPublished: Product | undefined
166
- let productUnpublished: Product | undefined
167
166
 
168
167
  beforeEach(async () => {
169
168
  let response
@@ -179,7 +178,6 @@ describe('Product update actions', () => {
179
178
  .send(unpublishedProductDraft)
180
179
 
181
180
  expect(response.status).toBe(201)
182
- productUnpublished = response.body
183
181
  })
184
182
 
185
183
  test('setAttribute masterVariant (staged)', async () => {