2020-04-22 17:21:12 +01:00
|
|
|
// Copyright (C) 2020 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
import Vuex from 'vuex';
|
|
|
|
|
|
|
|
import AddPaymentStep from '@/components/onboardingTour/steps/AddPaymentStep.vue';
|
|
|
|
|
|
|
|
import { PaymentsHttpApi } from '@/api/payments';
|
|
|
|
import { makePaymentsModule } from '@/store/modules/payments';
|
2020-12-04 15:38:28 +00:00
|
|
|
import { makeProjectsModule } from '@/store/modules/projects';
|
2021-04-15 18:53:09 +01:00
|
|
|
import { MetaUtils } from '@/utils/meta';
|
2020-04-22 17:21:12 +01:00
|
|
|
import { createLocalVue, shallowMount } from '@vue/test-utils';
|
|
|
|
|
2020-12-04 15:38:28 +00:00
|
|
|
import { ProjectsApiMock } from '../../mock/api/projects';
|
|
|
|
|
2020-04-22 17:21:12 +01:00
|
|
|
const localVue = createLocalVue();
|
|
|
|
localVue.use(Vuex);
|
2020-12-04 15:38:28 +00:00
|
|
|
const projectsApi = new ProjectsApiMock();
|
|
|
|
const projectsModule = makeProjectsModule(projectsApi);
|
2020-04-22 17:21:12 +01:00
|
|
|
const paymentsApi = new PaymentsHttpApi();
|
|
|
|
const paymentsModule = makePaymentsModule(paymentsApi);
|
|
|
|
|
2020-12-04 15:38:28 +00:00
|
|
|
const store = new Vuex.Store({ modules: { projectsModule, paymentsModule }});
|
2020-04-22 17:21:12 +01:00
|
|
|
|
2021-04-15 18:53:09 +01:00
|
|
|
jest.mock('@/utils/meta');
|
|
|
|
|
2020-04-22 17:21:12 +01:00
|
|
|
describe('AddPaymentStep.vue', () => {
|
|
|
|
it('renders correctly', async (): Promise<void> => {
|
2021-04-15 18:53:09 +01:00
|
|
|
MetaUtils.getMetaContent = jest.fn().mockReturnValue('1');
|
|
|
|
|
2020-04-22 17:21:12 +01:00
|
|
|
const wrapper = shallowMount(AddPaymentStep, {
|
|
|
|
store,
|
|
|
|
localVue,
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
|
|
|
|
await wrapper.find('.payment-step__methods-container__title-area__options-area__token').trigger('click');
|
|
|
|
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
});
|