19e9ca921a
Migrated last 2 vue components. Removed class component and vuex dependencies. Change-Id: I54a82cfae35a1c7eea6efbc07f89bf416a689e79
65 lines
2.0 KiB
TypeScript
65 lines
2.0 KiB
TypeScript
// Copyright (C) 2020 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
import { createLocalVue, shallowMount } from '@vue/test-utils';
|
|
|
|
import { ProjectsApiMock } from '@/../tests/unit/mock/api/projects';
|
|
import { ProjectLimits } from '@/types/projects';
|
|
import { NotificatorPlugin } from '@/utils/plugins/notificator';
|
|
|
|
import EditProjectDetails from '@/components/project/EditProjectDetails.vue';
|
|
|
|
const localVue = createLocalVue();
|
|
|
|
const projectLimits = new ProjectLimits(1000, 100, 1000, 100);
|
|
const projectsApi = new ProjectsApiMock();
|
|
projectsApi.setMockLimits(projectLimits);
|
|
|
|
localVue.use(new NotificatorPlugin());
|
|
|
|
describe('EditProjectDetails.vue', () => {
|
|
it('renders correctly', (): void => {
|
|
const wrapper = shallowMount<EditProjectDetails>(EditProjectDetails, {
|
|
localVue,
|
|
});
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
|
|
it('editing name works correctly', async (): Promise<void> => {
|
|
const wrapper = shallowMount<EditProjectDetails>(EditProjectDetails, {
|
|
localVue,
|
|
});
|
|
|
|
await wrapper.vm.toggleNameEditing();
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
const newName = 'new name';
|
|
|
|
wrapper.vm.$data.nameValue = newName;
|
|
await wrapper.vm.onSaveNameButtonClick();
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
// await expect(store.getters.selectedProject.name).toMatch(newName);
|
|
});
|
|
|
|
it('editing description works correctly', async (): Promise<void> => {
|
|
const wrapper = shallowMount<EditProjectDetails>(EditProjectDetails, {
|
|
localVue,
|
|
});
|
|
|
|
await wrapper.vm.toggleDescriptionEditing();
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
const newDescription = 'new description';
|
|
|
|
wrapper.vm.$data.descriptionValue = newDescription;
|
|
await wrapper.vm.onSaveDescriptionButtonClick();
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
// await expect(store.getters.selectedProject.description).toMatch(newDescription);
|
|
});
|
|
});
|