From a660857ef55c4810879952ffb4f84e6558f501b3 Mon Sep 17 00:00:00 2001 From: Carlos Cortizas Date: Thu, 5 Dec 2024 11:56:06 +0100 Subject: [PATCH] refactor(inventory-entry): adjust graphql types --- models/inventory-entry/package.json | 1 + models/inventory-entry/src/builders.spec.ts | 50 --------------------- models/inventory-entry/src/types.ts | 14 +++--- pnpm-lock.yaml | 3 ++ 4 files changed, 10 insertions(+), 58 deletions(-) diff --git a/models/inventory-entry/package.json b/models/inventory-entry/package.json index 99c9cfb7b..1bad876b4 100644 --- a/models/inventory-entry/package.json +++ b/models/inventory-entry/package.json @@ -22,6 +22,7 @@ "@commercetools-test-data/channel": "10.10.1", "@commercetools-test-data/commons": "10.10.1", "@commercetools-test-data/core": "10.10.1", + "@commercetools-test-data/graphql-types": "10.10.1", "@commercetools-test-data/product": "10.10.1", "@commercetools-test-data/utils": "10.10.1", "@commercetools/platform-sdk": "7.14.0", diff --git a/models/inventory-entry/src/builders.spec.ts b/models/inventory-entry/src/builders.spec.ts index fac5131f6..6761367ee 100644 --- a/models/inventory-entry/src/builders.spec.ts +++ b/models/inventory-entry/src/builders.spec.ts @@ -112,53 +112,3 @@ describe('InventoryEntry model compatibility builders', () => { ); }); }); - -describe('builder without supply channel', () => { - it( - ...createBuilderSpec( - 'rest', - InventoryEntry.random().supplyChannel(null), - expect.objectContaining({ - id: expect.any(String), - key: expect.any(String), - version: expect.any(Number), - createdAt: expect.any(String), - createdBy: null, - lastModifiedAt: expect.any(String), - lastModifiedBy: null, - sku: expect.any(String), - quantityOnStock: expect.any(Number), - restockableInDays: expect.any(Number), - availableQuantity: expect.any(Number), - expectedDelivery: expect.any(String), - supplyChannel: undefined, - custom: null, - }) - ) - ); - - it( - ...createBuilderSpec( - 'graphql', - InventoryEntry.random().supplyChannel(null), - expect.objectContaining({ - id: expect.any(String), - key: expect.any(String), - version: expect.any(Number), - createdAt: expect.any(String), - createdBy: null, - lastModifiedAt: expect.any(String), - lastModifiedBy: null, - sku: expect.any(String), - quantityOnStock: expect.any(Number), - restockableInDays: expect.any(Number), - availableQuantity: expect.any(Number), - expectedDelivery: expect.any(String), - supplyChannel: null, - supplyChannelRef: undefined, - custom: null, - __typename: 'InventoryEntry', - }) - ) - ); -}); diff --git a/models/inventory-entry/src/types.ts b/models/inventory-entry/src/types.ts index 77c483aa6..af947051a 100644 --- a/models/inventory-entry/src/types.ts +++ b/models/inventory-entry/src/types.ts @@ -2,9 +2,11 @@ import { InventoryEntry, InventoryEntryDraft, } from '@commercetools/platform-sdk'; -import { TChannelGraphql } from '@commercetools-test-data/channel'; -import type { TReferenceGraphql } from '@commercetools-test-data/commons'; import type { TBuilder } from '@commercetools-test-data/core'; +import type { + TCtpInventoryEntry, + TCtpInventoryEntryDraft, +} from '@commercetools-test-data/graphql-types'; // Default /** @@ -18,12 +20,8 @@ export type TInventoryEntryRest = InventoryEntry; export type TInventoryEntryDraftRest = InventoryEntryDraft; // GraphQL -export type TInventoryEntryGraphql = Omit & { - __typename: 'InventoryEntry'; - supplyChannel?: TChannelGraphql | null; - supplyChannelRef?: TReferenceGraphql<'channel'> | null; -}; -export type TInventoryEntryDraftGraphql = TInventoryEntryDraft; +export type TInventoryEntryGraphql = TCtpInventoryEntry; +export type TInventoryEntryDraftGraphql = TCtpInventoryEntryDraft; export type TInventoryEntryBuilder = TBuilder; export type TInventoryEntryDraftBuilder = TBuilder; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 321fbf091..525c81762 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -699,6 +699,9 @@ importers: '@commercetools-test-data/core': specifier: 10.10.1 version: link:../../core + '@commercetools-test-data/graphql-types': + specifier: 10.10.1 + version: link:../../graphql-types '@commercetools-test-data/product': specifier: 10.10.1 version: link:../product