2020-08-31 12:54:40 +01:00
|
|
|
// Copyright (C) 2020 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
import Vuex from 'vuex';
|
2022-09-08 15:11:09 +01:00
|
|
|
import { createLocalVue, mount } from '@vue/test-utils';
|
2020-08-31 12:54:40 +01:00
|
|
|
|
2022-09-08 15:11:09 +01:00
|
|
|
import { ProjectsApiMock } from '../mock/api/projects';
|
2020-08-31 12:54:40 +01:00
|
|
|
|
|
|
|
import { makeProjectsModule } from '@/store/modules/projects';
|
|
|
|
import { NotificatorPlugin } from '@/utils/plugins/notificator';
|
|
|
|
|
2022-09-08 15:11:09 +01:00
|
|
|
import CreateProject from '@/components/project/CreateProject.vue';
|
2020-08-31 12:54:40 +01:00
|
|
|
|
|
|
|
const localVue = createLocalVue();
|
2022-04-07 12:04:24 +01:00
|
|
|
|
2020-08-31 12:54:40 +01:00
|
|
|
localVue.use(Vuex);
|
|
|
|
|
|
|
|
const projectsApi = new ProjectsApiMock();
|
|
|
|
const projectsModule = makeProjectsModule(projectsApi);
|
2022-09-08 15:11:09 +01:00
|
|
|
const store = new Vuex.Store({ modules: { projectsModule } });
|
2020-08-31 12:54:40 +01:00
|
|
|
|
2022-04-07 12:04:24 +01:00
|
|
|
localVue.use(new NotificatorPlugin(store));
|
|
|
|
|
2020-08-31 12:54:40 +01:00
|
|
|
describe('CreateProject.vue', (): void => {
|
|
|
|
it('renders correctly', (): void => {
|
2022-04-07 12:04:24 +01:00
|
|
|
const wrapper = mount<CreateProject>(CreateProject, {
|
2020-08-31 12:54:40 +01:00
|
|
|
store,
|
|
|
|
localVue,
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders correctly with project name', async (): Promise<void> => {
|
2022-04-07 12:04:24 +01:00
|
|
|
const wrapper = mount<CreateProject>(CreateProject, {
|
2020-08-31 12:54:40 +01:00
|
|
|
store,
|
|
|
|
localVue,
|
|
|
|
});
|
|
|
|
|
|
|
|
await wrapper.vm.setProjectName('testName');
|
|
|
|
|
|
|
|
expect(wrapper.findAll('.disabled').length).toBe(0);
|
|
|
|
});
|
|
|
|
});
|