浏览代码

chore(payments-plugin): Fix broken e2e tests

Michael Bromley 2 年之前
父节点
当前提交
df89553771

+ 22 - 7
packages/payments-plugin/e2e/mollie-payment.e2e-spec.ts

@@ -14,7 +14,7 @@ import {
 import nock from 'nock';
 import fetch from 'node-fetch';
 import path from 'path';
-import { afterAll, beforeAll, describe, expect, it } from 'vitest';
+import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest';
 
 import { initialData } from '../../../e2e-common/e2e-initial-data';
 import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config';
@@ -551,8 +551,7 @@ describe('Mollie payments (with useDynamicRedirectUrl set to true)', () => {
         >(CREATE_PAYMENT_METHOD, {
             input: {
                 code: mockData.methodCodeBroken,
-                name: 'Mollie payment test',
-                description: 'This is a Mollie test payment method',
+
                 enabled: true,
                 handler: {
                     code: molliePaymentHandler.code,
@@ -561,6 +560,13 @@ describe('Mollie payments (with useDynamicRedirectUrl set to true)', () => {
                         { name: 'autoCapture', value: 'false' },
                     ],
                 },
+                translations: [
+                    {
+                        languageCode: LanguageCode.en,
+                        name: 'Mollie payment test',
+                        description: 'This is a Mollie test payment method',
+                    },
+                ],
             },
         });
         expect(createPaymentMethod.code).toBe(mockData.methodCodeBroken);
@@ -600,7 +606,9 @@ describe('Mollie payments (with useDynamicRedirectUrl set to true)', () => {
                 molliePaymentMethodCode: 'ideal',
             },
         });
-        expect(createMolliePaymentIntent.message).toContain('Cannot create payment intent without redirectUrl specified in paymentMethod');
+        expect(createMolliePaymentIntent.message).toContain(
+            'Cannot create payment intent without redirectUrl specified in paymentMethod',
+        );
     });
 });
 
@@ -674,8 +682,6 @@ describe('Mollie payments (with useDynamicRedirectUrl set to true)', () => {
         >(CREATE_PAYMENT_METHOD, {
             input: {
                 code: mockData.methodCode,
-                name: 'Mollie payment test',
-                description: 'This is a Mollie test payment method',
                 enabled: true,
                 handler: {
                     code: molliePaymentHandler.code,
@@ -684,6 +690,13 @@ describe('Mollie payments (with useDynamicRedirectUrl set to true)', () => {
                         { name: 'autoCapture', value: 'false' },
                     ],
                 },
+                translations: [
+                    {
+                        languageCode: LanguageCode.en,
+                        name: 'Mollie payment test',
+                        description: 'This is a Mollie test payment method',
+                    },
+                ],
             },
         });
         expect(createPaymentMethod.code).toBe(mockData.methodCode);
@@ -749,6 +762,8 @@ describe('Mollie payments (with useDynamicRedirectUrl set to true)', () => {
                 molliePaymentMethodCode: 'ideal',
             },
         });
-        expect(createMolliePaymentIntent.message).toContain('Cannot create payment intent without redirectUrl specified');
+        expect(createMolliePaymentIntent.message).toContain(
+            'Cannot create payment intent without redirectUrl specified',
+        );
     });
 });

+ 2 - 0
packages/payments-plugin/e2e/stripe-metadata-sanitize.e2e-spec.ts

@@ -1,3 +1,5 @@
+import { describe, expect, it } from 'vitest';
+
 import { sanitizeMetadata } from '../src/stripe/metadata-sanitize';
 
 describe('Stripe Metadata Sanitize', () => {

+ 1 - 1
packages/payments-plugin/e2e/stripe-payment.e2e-spec.ts

@@ -179,7 +179,7 @@ describe('Stripe payments', () => {
     // https://github.com/vendure-ecommerce/vendure/issues/1935
     it('should attach metadata to stripe payment intent', async () => {
         StripePlugin.options.metadata = async (injector, ctx, currentOrder) => {
-            const hydrator = await injector.get(EntityHydrator);
+            const hydrator = injector.get(EntityHydrator);
             await hydrator.hydrate(ctx, currentOrder, { relations: ['customer'] });
             return {
                 customerEmail: currentOrder.customer?.emailAddress ?? 'demo',