Browse Source

chore: Fixes after merge

Michael Bromley 3 năm trước cách đây
mục cha
commit
786cb9eef4

+ 20 - 11
packages/core/e2e/facet.e2e-spec.ts

@@ -125,13 +125,14 @@ describe('Facet resolver', () => {
     });
 
     it('updateFacetValues', async () => {
+        const portableFacetValue = speakerTypeFacet.values.find(v => v.code === 'portable')!;
         const result = await adminClient.query<
             Codegen.UpdateFacetValuesMutation,
             Codegen.UpdateFacetValuesMutationVariables
         >(UPDATE_FACET_VALUES, {
             input: [
                 {
-                    id: speakerTypeFacet.values[0].id,
+                    id: portableFacetValue.id,
                     code: 'compact',
                 },
             ],
@@ -229,13 +230,15 @@ describe('Facet resolver', () => {
                 GET_PRODUCTS_LIST_WITH_VARIANTS,
             );
             products = result1.products.items;
+            const pcFacetValue = speakerTypeFacet.values.find(v => v.code === 'pc')!;
+            const hifiFacetValue = speakerTypeFacet.values.find(v => v.code === 'hi-fi')!;
 
             await adminClient.query<Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables>(
                 UPDATE_PRODUCT,
                 {
                     input: {
                         id: products[0].id,
-                        facetValueIds: [speakerTypeFacet.values[0].id],
+                        facetValueIds: [pcFacetValue.id],
                     },
                 },
             );
@@ -247,7 +250,7 @@ describe('Facet resolver', () => {
                 input: [
                     {
                         id: products[0].variants[0].id,
-                        facetValueIds: [speakerTypeFacet.values[0].id],
+                        facetValueIds: [pcFacetValue.id],
                     },
                 ],
             });
@@ -257,14 +260,14 @@ describe('Facet resolver', () => {
                 {
                     input: {
                         id: products[1].id,
-                        facetValueIds: [speakerTypeFacet.values[1].id],
+                        facetValueIds: [hifiFacetValue.id],
                     },
                 },
             );
         });
 
         it('deleteFacetValues deletes unused facetValue', async () => {
-            const facetValueToDelete = speakerTypeFacet.values[2];
+            const facetValueToDelete = speakerTypeFacet.values.find(v => v.code === 'compact')!;
             const result1 = await adminClient.query<
                 Codegen.DeleteFacetValuesMutation,
                 Codegen.DeleteFacetValuesMutationVariables
@@ -290,7 +293,7 @@ describe('Facet resolver', () => {
         });
 
         it('deleteFacetValues for FacetValue in use returns NOT_DELETED', async () => {
-            const facetValueToDelete = speakerTypeFacet.values[0];
+            const facetValueToDelete = speakerTypeFacet.values.find(v => v.code === 'pc')!;
             const result1 = await adminClient.query<
                 Codegen.DeleteFacetValuesMutation,
                 Codegen.DeleteFacetValuesMutationVariables
@@ -308,7 +311,7 @@ describe('Facet resolver', () => {
             expect(result1.deleteFacetValues).toEqual([
                 {
                     result: DeletionResult.NOT_DELETED,
-                    message: `The FacetValue "compact" is assigned to 1 Product, 1 ProductVariant`,
+                    message: `The FacetValue "pc" is assigned to 1 Product, 1 ProductVariant`,
                 },
             ]);
 
@@ -316,7 +319,7 @@ describe('Facet resolver', () => {
         });
 
         it('deleteFacetValues for FacetValue in use can be force deleted', async () => {
-            const facetValueToDelete = speakerTypeFacet.values[0];
+            const facetValueToDelete = speakerTypeFacet.values.find(v => v.code === 'pc')!;
             const result1 = await adminClient.query<
                 Codegen.DeleteFacetValuesMutation,
                 Codegen.DeleteFacetValuesMutationVariables
@@ -675,7 +678,9 @@ describe('Facet resolver', () => {
             ]);
 
             adminClient.setChannelToken(SECOND_CHANNEL_TOKEN);
-            const { facets: after } = await adminClient.query<Codegen.GetFacetListSimpleQuery>(GET_FACET_LIST_SIMPLE);
+            const { facets: after } = await adminClient.query<Codegen.GetFacetListSimpleQuery>(
+                GET_FACET_LIST_SIMPLE,
+            );
             expect(after.items).toEqual([{ id: 'T_4', name: 'Channel Facet' }]);
         });
 
@@ -701,7 +706,9 @@ describe('Facet resolver', () => {
             expect(removeFacetsFromChannel).toEqual([{ id: 'T_4', name: 'Channel Facet' }]);
 
             adminClient.setChannelToken(SECOND_CHANNEL_TOKEN);
-            const { facets: after } = await adminClient.query<Codegen.GetFacetListSimpleQuery>(GET_FACET_LIST_SIMPLE);
+            const { facets: after } = await adminClient.query<Codegen.GetFacetListSimpleQuery>(
+                GET_FACET_LIST_SIMPLE,
+            );
             expect(after.items).toEqual([]);
         });
 
@@ -726,7 +733,9 @@ describe('Facet resolver', () => {
             expect(assignFacetsToChannel).toEqual([{ id: 'T_4', name: 'Channel Facet' }]);
 
             adminClient.setChannelToken(SECOND_CHANNEL_TOKEN);
-            const { facets: after } = await adminClient.query<Codegen.GetFacetListSimpleQuery>(GET_FACET_LIST_SIMPLE);
+            const { facets: after } = await adminClient.query<Codegen.GetFacetListSimpleQuery>(
+                GET_FACET_LIST_SIMPLE,
+            );
             expect(after.items).toEqual([{ id: 'T_4', name: 'Channel Facet' }]);
         });
     });

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 297 - 293
packages/core/e2e/graphql/generated-e2e-admin-types.ts


+ 4 - 1
packages/core/src/api/config/generate-active-order-types.ts

@@ -5,6 +5,7 @@ import {
     GraphQLInputFieldConfigMap,
     GraphQLInputObjectType,
     GraphQLSchema,
+    GraphQLObjectType,
     isInputObjectType,
 } from 'graphql';
 
@@ -90,7 +91,9 @@ export function generateActiveOrderTypes(
                 `Could not find a GraphQL type definition for the field ${operation.name}`,
             );
         }
-        field.args.push({
+
+        // TODO: Figure out a non-hacky way to do this!
+        (field.args as any).push({
             name: ACTIVE_ORDER_INPUT_FIELD_NAME,
             type: activeOrderInput,
             description,

+ 12 - 5
yarn.lock

@@ -16179,6 +16179,13 @@ semver@^7.3.7:
   dependencies:
     lru-cache "^6.0.0"
 
+semver@^7.3.8:
+  version "7.3.8"
+  resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798"
+  integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==
+  dependencies:
+    lru-cache "^6.0.0"
+
 semver@~5.3.0:
   version "5.3.0"
   resolved "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
@@ -16299,16 +16306,16 @@ shallow-clone@^3.0.0:
   dependencies:
     kind-of "^6.0.2"
 
-sharp@~0.30.7:
-  version "0.30.7"
-  resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.30.7.tgz#7862bda98804fdd1f0d5659c85e3324b90d94c7c"
-  integrity sha512-G+MY2YW33jgflKPTXXptVO28HvNOo9G3j0MybYAHeEmby+QuD2U98dT6ueht9cv/XDqZspSpIhoSW+BAKJ7Hig==
+sharp@~0.31.2:
+  version "0.31.2"
+  resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.31.2.tgz#a8411c80512027f5a452b76d599268760c4e5dfa"
+  integrity sha512-DUdNVEXgS5A97cTagSLIIp8dUZ/lZtk78iNVZgHdHbx1qnQR7JAHY0BnXnwwH39Iw+VKhO08CTYhIg0p98vQ5Q==
   dependencies:
     color "^4.2.3"
     detect-libc "^2.0.1"
     node-addon-api "^5.0.0"
     prebuild-install "^7.1.1"
-    semver "^7.3.7"
+    semver "^7.3.8"
     simple-get "^4.0.1"
     tar-fs "^2.1.1"
     tunnel-agent "^0.6.0"

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác