Browse Source

test(core): Extract gql definition to shop-definitions.ts

Michael Bromley 4 years ago
parent
commit
a3aa3e2b68

+ 21 - 0
packages/core/e2e/graphql/shop-definitions.ts

@@ -703,3 +703,24 @@ export const GET_PRODUCT_WITH_STOCK_LEVEL = gql`
         }
     }
 `;
+
+export const ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS = gql`
+    mutation AddItemToOrderWithCustomFields(
+        $productVariantId: ID!
+        $quantity: Int!
+        $customFields: OrderLineCustomFieldsInput
+    ) {
+        addItemToOrder(
+            productVariantId: $productVariantId
+            quantity: $quantity
+            customFields: $customFields
+        ) {
+            ...UpdatedOrder
+            ... on ErrorResult {
+                errorCode
+                message
+            }
+        }
+    }
+    ${UPDATED_ORDER_FRAGMENT}
+`;

+ 1 - 23
packages/core/e2e/shop-order.e2e-spec.ts

@@ -64,6 +64,7 @@ import {
 } from './graphql/shared-definitions';
 import {
     ADD_ITEM_TO_ORDER,
+    ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS,
     ADD_PAYMENT,
     ADJUST_ITEM_QUANTITY,
     GET_ACTIVE_ORDER,
@@ -81,9 +82,7 @@ import {
     SET_CUSTOMER,
     SET_SHIPPING_ADDRESS,
     SET_SHIPPING_METHOD,
-    TEST_ORDER_FRAGMENT,
     TRANSITION_TO_STATE,
-    UPDATED_ORDER_FRAGMENT,
 } from './graphql/shop-definitions';
 import { assertThrowsWithMessage } from './utils/assert-throws-with-message';
 
@@ -1854,27 +1853,6 @@ const SET_ORDER_CUSTOM_FIELDS = gql`
     }
 `;
 
-export const ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS = gql`
-    mutation AddItemToOrderWithCustomFields(
-        $productVariantId: ID!
-        $quantity: Int!
-        $customFields: OrderLineCustomFieldsInput
-    ) {
-        addItemToOrder(
-            productVariantId: $productVariantId
-            quantity: $quantity
-            customFields: $customFields
-        ) {
-            ...UpdatedOrder
-            ... on ErrorResult {
-                errorCode
-                message
-            }
-        }
-    }
-    ${UPDATED_ORDER_FRAGMENT}
-`;
-
 export const LOG_OUT = gql`
     mutation LogOut {
         logout {