2020-04-22 17:21:12 +01:00
|
|
|
// Copyright (C) 2020 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
2020-12-04 12:47:12 +00:00
|
|
|
import Vuex from 'vuex';
|
|
|
|
|
2020-04-22 17:21:12 +01:00
|
|
|
import OverviewStep from '@/components/onboardingTour/steps/OverviewStep.vue';
|
|
|
|
|
2020-12-04 12:47:12 +00:00
|
|
|
import { PaymentsHttpApi } from '@/api/payments';
|
|
|
|
import { router } from '@/router';
|
|
|
|
import { makePaymentsModule, PAYMENTS_MUTATIONS } from '@/store/modules/payments';
|
2020-12-04 15:38:28 +00:00
|
|
|
import { makeProjectsModule } from '@/store/modules/projects';
|
|
|
|
import { createLocalVue, mount } from '@vue/test-utils';
|
2020-04-22 17:21:12 +01:00
|
|
|
|
2020-12-04 15:38:28 +00:00
|
|
|
import { ProjectsApiMock } from '../../mock/api/projects';
|
|
|
|
|
|
|
|
const localVue = createLocalVue();
|
|
|
|
localVue.use(Vuex);
|
|
|
|
const projectsApi = new ProjectsApiMock();
|
|
|
|
const projectsModule = makeProjectsModule(projectsApi);
|
2020-12-04 12:47:12 +00: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-12-04 12:47:12 +00:00
|
|
|
|
|
|
|
describe('OverviewStep.vue', (): void => {
|
2020-04-22 17:21:12 +01:00
|
|
|
it('renders correctly', async (): Promise<void> => {
|
2020-12-04 12:47:12 +00:00
|
|
|
const wrapper = mount(OverviewStep, {
|
2020-12-04 15:38:28 +00:00
|
|
|
localVue,
|
2020-12-04 12:47:12 +00:00
|
|
|
router,
|
|
|
|
store,
|
|
|
|
});
|
|
|
|
|
|
|
|
await store.commit(PAYMENTS_MUTATIONS.SET_PAYWALL_ENABLED_STATUS, true);
|
2020-04-22 17:21:12 +01:00
|
|
|
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
|
2020-12-04 12:47:12 +00:00
|
|
|
await store.commit(PAYMENTS_MUTATIONS.SET_PAYWALL_ENABLED_STATUS, false);
|
2020-04-22 17:21:12 +01:00
|
|
|
|
2020-12-04 12:47:12 +00:00
|
|
|
expect(wrapper).toMatchSnapshot();
|
2020-04-22 17:21:12 +01:00
|
|
|
});
|
|
|
|
});
|