Skip to content

Commit

Permalink
PPI-1030 - Added jest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cyl3x committed Dec 9, 2024
1 parent a703c1d commit 63e835d
Show file tree
Hide file tree
Showing 11 changed files with 1,471 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Resources/app/administration/jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@ import 'SwagPayPal/mixin/swag-paypal-credentials-loader.mixin';
import 'SwagPayPal/mixin/swag-paypal-notification.mixin';
import 'SwagPayPal/mixin/swag-paypal-pos-catch-error.mixin';
import 'SwagPayPal/mixin/swag-paypal-pos-log-label.mixin';

import 'SwagPayPal/mixin/swag-paypal-settings.mixin';
import 'SwagPayPal/mixin/swag-paypal-merchant-information.mixin';

import 'SwagPayPal/app/store/swag-paypal-settings.store';
import 'SwagPayPal/app/store/swag-paypal-merchant-information.store';
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { mount } from '@vue/test-utils';
import SwagPayPalOnboardingButton from '.';

Shopware.Component.register('swag-paypal-onboarding-button', Promise.resolve(SwagPayPalOnboardingButton));

async function createWrapper() {
return mount(
await Shopware.Component.build('swag-paypal-onboarding-button') as typeof SwagPayPalOnboardingButton,
{
global: {
mocks: { $t: (key: string) => key },
provide: {
acl: { can: () => true },
SwagPayPalSettingsService: {
getApiCredentials: jest.fn(),

Check failure on line 15 in src/Resources/app/administration/src/app/component/swag-paypal-onboarding-button/swag-paypal-onboarding-button.spec.ts

View workflow job for this annotation

GitHub Actions / eslint

Unsafe assignment of an `any` value

Check failure on line 15 in src/Resources/app/administration/src/app/component/swag-paypal-onboarding-button/swag-paypal-onboarding-button.spec.ts

View workflow job for this annotation

GitHub Actions / eslint

Unsafe member access .fn on an `any` value

Check failure on line 15 in src/Resources/app/administration/src/app/component/swag-paypal-onboarding-button/swag-paypal-onboarding-button.spec.ts

View workflow job for this annotation

GitHub Actions / eslint

Unsafe call of an `any` typed value
},
},
},
},
);
}

describe('swag-paypal-onboarding-button', () => {

Check failure on line 23 in src/Resources/app/administration/src/app/component/swag-paypal-onboarding-button/swag-paypal-onboarding-button.spec.ts

View workflow job for this annotation

GitHub Actions / eslint

Unsafe call of an `any` typed value
it('should be a Vue.js component', async () => {

Check failure on line 24 in src/Resources/app/administration/src/app/component/swag-paypal-onboarding-button/swag-paypal-onboarding-button.spec.ts

View workflow job for this annotation

GitHub Actions / eslint

Unsafe call of an `any` typed value
const wrapper = await createWrapper();

expect(wrapper.vm).toBeTruthy();

Check failure on line 27 in src/Resources/app/administration/src/app/component/swag-paypal-onboarding-button/swag-paypal-onboarding-button.spec.ts

View workflow job for this annotation

GitHub Actions / eslint

Unsafe member access .toBeTruthy on an `any` value

Check failure on line 27 in src/Resources/app/administration/src/app/component/swag-paypal-onboarding-button/swag-paypal-onboarding-button.spec.ts

View workflow job for this annotation

GitHub Actions / eslint

Unsafe call of an `any` typed value

Check failure on line 27 in src/Resources/app/administration/src/app/component/swag-paypal-onboarding-button/swag-paypal-onboarding-button.spec.ts

View workflow job for this annotation

GitHub Actions / eslint

Unsafe call of an `any` typed value
});
});
Loading

0 comments on commit 63e835d

Please sign in to comment.