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';
|
|
|
|
|
2020-10-05 18:33:16 +01:00
|
|
|
import { appStateModule } from '@/store/modules/appState';
|
2020-03-18 17:07:29 +00:00
|
|
|
import { makeProjectsModule, PROJECTS_MUTATIONS } from '@/store/modules/projects';
|
2020-10-05 18:33:16 +01:00
|
|
|
import { makeUsersModule } from '@/store/modules/users';
|
2020-03-18 17:07:29 +00:00
|
|
|
import { Project } from '@/types/projects';
|
|
|
|
import { SegmentioPlugin } from '@/utils/plugins/segment';
|
|
|
|
import { createLocalVue, shallowMount } from '@vue/test-utils';
|
|
|
|
|
|
|
|
import { ProjectsApiMock } from '../mock/api/projects';
|
2020-10-05 18:33:16 +01:00
|
|
|
import { UsersApiMock } from '../mock/api/users';
|
2020-03-18 17:07:29 +00:00
|
|
|
|
|
|
|
const segmentioPlugin = new SegmentioPlugin();
|
|
|
|
const localVue = createLocalVue();
|
|
|
|
localVue.use(Vuex);
|
|
|
|
localVue.use(segmentioPlugin);
|
|
|
|
|
2020-10-05 18:33:16 +01:00
|
|
|
const usersApi = new UsersApiMock();
|
|
|
|
const usersModule = makeUsersModule(usersApi);
|
2020-03-18 17:07:29 +00:00
|
|
|
const projectsApi = new ProjectsApiMock();
|
|
|
|
const projectsModule = makeProjectsModule(projectsApi);
|
|
|
|
|
2020-10-05 18:33:16 +01:00
|
|
|
const store = new Vuex.Store({ modules: { appStateModule, usersModule, projectsModule }});
|
2020-03-18 17:07:29 +00:00
|
|
|
const project = new Project('id', 'test', 'test', 'test', 'ownedId', false);
|
|
|
|
|
|
|
|
describe('ProjectDashboard.vue', () => {
|
|
|
|
it('renders correctly', (): void => {
|
|
|
|
store.commit(PROJECTS_MUTATIONS.ADD, project);
|
|
|
|
store.commit(PROJECTS_MUTATIONS.SELECT_PROJECT, project.id);
|
|
|
|
|
|
|
|
const wrapper = shallowMount(ProjectDashboard, {
|
|
|
|
store,
|
|
|
|
localVue,
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
});
|