2020-03-18 17:07:29 +00:00
|
|
|
// Copyright (C) 2020 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
import Vuex from 'vuex';
|
|
|
|
|
|
|
|
import ProjectDashboard from '@/components/project/ProjectDashboard.vue';
|
|
|
|
|
2021-06-09 16:13:19 +01:00
|
|
|
import { makeAccessGrantsModule } from '@/store/modules/accessGrants';
|
2020-10-05 18:33:16 +01:00
|
|
|
import { appStateModule } from '@/store/modules/appState';
|
2021-06-09 16:13:19 +01:00
|
|
|
import { makeBucketsModule } from '@/store/modules/buckets';
|
|
|
|
import { makePaymentsModule } from '@/store/modules/payments';
|
|
|
|
import { makeProjectMembersModule } from '@/store/modules/projectMembers';
|
2020-03-18 17:07:29 +00:00
|
|
|
import { makeProjectsModule, PROJECTS_MUTATIONS } from '@/store/modules/projects';
|
2021-06-09 16:13:19 +01:00
|
|
|
import { AccessGrantsPage } from '@/types/accessGrants';
|
|
|
|
import { ProjectMembersPage } from '@/types/projectMembers';
|
2020-03-18 17:07:29 +00:00
|
|
|
import { Project } from '@/types/projects';
|
|
|
|
import { createLocalVue, shallowMount } from '@vue/test-utils';
|
|
|
|
|
2021-06-09 16:13:19 +01:00
|
|
|
import { AccessGrantsMock } from '../mock/api/accessGrants';
|
|
|
|
import { BucketsMock } from '../mock/api/buckets';
|
|
|
|
import { PaymentsMock } from '../mock/api/payments';
|
|
|
|
import { ProjectMembersApiMock } from '../mock/api/projectMembers';
|
2020-03-18 17:07:29 +00:00
|
|
|
import { ProjectsApiMock } from '../mock/api/projects';
|
|
|
|
|
|
|
|
const localVue = createLocalVue();
|
|
|
|
localVue.use(Vuex);
|
|
|
|
|
|
|
|
const projectsApi = new ProjectsApiMock();
|
|
|
|
const projectsModule = makeProjectsModule(projectsApi);
|
2021-06-09 16:13:19 +01:00
|
|
|
const bucketsApi = new BucketsMock();
|
|
|
|
const bucketsModule = makeBucketsModule(bucketsApi);
|
|
|
|
const paymentsApi = new PaymentsMock();
|
|
|
|
const paymentsModule = makePaymentsModule(paymentsApi);
|
|
|
|
const membersApi = new ProjectMembersApiMock();
|
|
|
|
const membersModule = makeProjectMembersModule(membersApi);
|
|
|
|
const grantsApi = new AccessGrantsMock();
|
|
|
|
const grantsModule = makeAccessGrantsModule(grantsApi);
|
|
|
|
|
|
|
|
const store = new Vuex.Store({ modules: { appStateModule, projectsModule, bucketsModule, paymentsModule, membersModule, grantsModule }});
|
2020-03-18 17:07:29 +00:00
|
|
|
|
|
|
|
const project = new Project('id', 'test', 'test', 'test', 'ownedId', false);
|
2021-06-09 16:13:19 +01:00
|
|
|
const membersPage = new ProjectMembersPage();
|
|
|
|
membersApi.setMockPage(membersPage);
|
|
|
|
const grantsPage = new AccessGrantsPage();
|
|
|
|
grantsApi.setMockAccessGrantsPage(grantsPage);
|
2020-03-18 17:07:29 +00:00
|
|
|
|
|
|
|
describe('ProjectDashboard.vue', () => {
|
2021-06-09 16:13:19 +01:00
|
|
|
it('renders correctly', async (): Promise<void> => {
|
2020-03-18 17:07:29 +00:00
|
|
|
store.commit(PROJECTS_MUTATIONS.ADD, project);
|
|
|
|
store.commit(PROJECTS_MUTATIONS.SELECT_PROJECT, project.id);
|
|
|
|
|
|
|
|
const wrapper = shallowMount(ProjectDashboard, {
|
|
|
|
store,
|
|
|
|
localVue,
|
|
|
|
});
|
|
|
|
|
2021-06-09 16:13:19 +01:00
|
|
|
await wrapper.setData({
|
|
|
|
areBucketsFetching: false,
|
|
|
|
isSummaryDataFetching: false,
|
|
|
|
});
|
|
|
|
|
2020-03-18 17:07:29 +00:00
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
});
|