Skip to content

Commit

Permalink
refactor: Move test files alongside tested files
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgrozav committed Nov 1, 2024
1 parent aa7bb3a commit 7e58fc4
Show file tree
Hide file tree
Showing 130 changed files with 4,244 additions and 152 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createComponentRenderer } from '@/__tests__/render';
import { createTestingPinia } from '@pinia/testing';
import userEvent from '@testing-library/user-event';
import Assignment from '../Assignment.vue';
import Assignment from './Assignment.vue';
import { defaultSettings } from '@/__tests__/defaults';
import { STORES } from '@/constants';
import { merge } from 'lodash-es';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createTestingPinia } from '@pinia/testing';
import userEvent from '@testing-library/user-event';
import { fireEvent, within } from '@testing-library/vue';
import * as workflowHelpers from '@/composables/useWorkflowHelpers';
import AssignmentCollection from '../AssignmentCollection.vue';
import AssignmentCollection from './AssignmentCollection.vue';
import { STORES } from '@/constants';
import { cleanupAppModals, createAppModals, SETTINGS_STORE_DEFAULT_STATE } from '@/__tests__/utils';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createComponentRenderer } from '@/__tests__/render';
import { createTestingPinia } from '@pinia/testing';
import userEvent from '@testing-library/user-event';
import TypeSelect from '../TypeSelect.vue';
import TypeSelect from './TypeSelect.vue';

const DEFAULT_SETUP = {
pinia: createTestingPinia(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CompletionContext } from '@codemirror/autocomplete';
import { EditorSelection, EditorState } from '@codemirror/state';
import { useItemFieldCompletions } from '../itemField.completions';
import { useItemFieldCompletions } from './itemField.completions';

describe('inputMethodCompletions', () => {
test('should return completions for $input.item.|', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createComponentRenderer } from '@/__tests__/render';
import { createTestingPinia } from '@pinia/testing';
import CollectionParameter from '../CollectionParameter.vue';
import CollectionParameter from './CollectionParameter.vue';

const renderComponent = createComponentRenderer(CollectionParameter, {
pinia: createTestingPinia(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createComponentRenderer } from '@/__tests__/render';
import CommunityPackageInstallModal from '../CommunityPackageInstallModal.vue';
import CommunityPackageInstallModal from './CommunityPackageInstallModal.vue';
import { createTestingPinia } from '@pinia/testing';
import { COMMUNITY_PACKAGE_INSTALL_MODAL_KEY, STORES } from '@/constants';
import userEvent from '@testing-library/user-event';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import CredentialIcon from '@/components/CredentialIcon.vue';
import { createComponentRenderer } from '@/__tests__/render';
import { useCredentialsStore } from '@/stores/credentials.store';
import { useRootStore } from '@/stores/root.store';
import { useNodeTypesStore } from '../../stores/nodeTypes.store';
import { useNodeTypesStore } from '../stores/nodeTypes.store';

describe('CredentialIcon', () => {
const renderComponent = createComponentRenderer(CredentialIcon, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createTestingPinia } from '@pinia/testing';
import userEvent from '@testing-library/user-event';
import { fireEvent } from '@testing-library/vue';
import { createPinia, setActivePinia } from 'pinia';
import DropArea from '../DropArea.vue';
import DropArea from './DropArea.vue';

const renderComponent = createComponentRenderer(DropArea, {
pinia: createTestingPinia(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useNDVStore } from '@/stores/ndv.store';
import { createTestingPinia } from '@pinia/testing';
import userEvent from '@testing-library/user-event';
import { within, waitFor } from '@testing-library/vue';
import { getFilterOperator } from '../utils';
import { getFilterOperator } from './utils';
import { get } from 'lodash-es';

const DEFAULT_SETUP = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getFilterOperator, handleOperatorChange, inferOperatorType } from '../utils';
import { getFilterOperator, handleOperatorChange, inferOperatorType } from './utils';

describe('FilterConditions > utils', () => {
describe('handleOperatorChange', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import HtmlEditor from '@/components/HtmlEditor/HtmlEditor.vue';
import { userEvent } from '@testing-library/user-event';
import { waitFor } from '@testing-library/vue';
import { setActivePinia } from 'pinia';
import { htmlEditorEventBus } from '../../event-bus';
import { htmlEditorEventBus } from '../event-bus';

const DEFAULT_SETUP = {
props: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { renderComponent } from '@/__tests__/render';
import { createTestingPinia } from '@pinia/testing';
import InlineExpressionEditorOutput from '../InlineExpressionEditorOutput.vue';
import InlineExpressionEditorOutput from './InlineExpressionEditorOutput.vue';

describe('InlineExpressionEditorOutput.vue', () => {
test('should render duplicate segments correctly', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createComponentRenderer } from '@/__tests__/render';
import InputTriple from '../InputTriple.vue';
import InputTriple from './InputTriple.vue';

const renderComponent = createComponentRenderer(InputTriple);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { screen } from '@testing-library/vue';
import CategoryItem from '../ItemTypes/CategoryItem.vue';
import CategoryItem from './ItemTypes/CategoryItem.vue';
import { createComponentRenderer } from '@/__tests__/render';

const renderComponent = createComponentRenderer(CategoryItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
mockActionCreateElement,
mockViewCreateElement,
mockSectionCreateElement,
} from './utils';
} from './__tests__/utils';
import ItemsRenderer from '@/components/Node/NodeCreator/Renderers/ItemsRenderer.vue';
import { createComponentRenderer } from '@/__tests__/render';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { createPinia } from 'pinia';
import { screen, fireEvent } from '@testing-library/vue';
import type { INodeTypeDescription } from 'n8n-workflow';
import { useNodeCreatorStore } from '@/stores/nodeCreator.store';
import { mockSimplifiedNodeType } from './utils';
import NodesListPanel from '../Panel/NodesListPanel.vue';
import { mockSimplifiedNodeType } from './__tests__/utils';
import NodesListPanel from './Panel/NodesListPanel.vue';
import { REGULAR_NODE_CREATOR_VIEW } from '@/constants';
import type { NodeFilterType } from '@/Interface';
import { createComponentRenderer } from '@/__tests__/render';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createTestingPinia } from '@pinia/testing';
import { useNodeCreatorStore } from '@/stores/nodeCreator.store';
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
import { useWorkflowsStore } from '@/stores/workflows.store';
import { useActions } from '../composables/useActions';
import { useActions } from './composables/useActions';
import {
HTTP_REQUEST_NODE_TYPE,
MANUAL_TRIGGER_NODE_TYPE,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NodeConnectionType, type INodeProperties, type INodeTypeDescription } from 'n8n-workflow';
import { useActionsGenerator } from '../composables/useActionsGeneration';
import { useActionsGenerator } from './composables/useActionsGeneration';

describe('useActionsGenerator', () => {
const { generateMergedNodesAndActions } = useActionsGenerator();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import userEvent from '@testing-library/user-event';
import { defineComponent, computed } from 'vue';
import { useKeyboardNavigation } from '../composables/useKeyboardNavigation';
import { useKeyboardNavigation } from './composables/useKeyboardNavigation';
import { createComponentRenderer } from '@/__tests__/render';
import { createPinia } from 'pinia';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import type { SectionCreateElement } from '@/Interface';
import { formatTriggerActionName, groupItemsInSections, sortNodeCreateElements } from '../utils';
import { mockActionCreateElement, mockNodeCreateElement, mockSectionCreateElement } from './utils';
import { formatTriggerActionName, groupItemsInSections, sortNodeCreateElements } from './utils';
import {
mockActionCreateElement,
mockNodeCreateElement,
mockSectionCreateElement,
} from './__tests__/utils';

describe('NodeCreator - utils', () => {
describe('groupItemsInSections', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
DEFAULT_SETUP,
MAPPING_COLUMNS_RESPONSE,
UPDATED_SCHEMA,
} from './utils/ResourceMapper.utils';
} from './__tests__/utils/ResourceMapper.utils';
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
import { cleanupAppModals, createAppModals, waitAllPromises } from '@/__tests__/utils';
import ResourceMapper from '@/components/ResourceMapper/ResourceMapper.vue';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import VariablesRow from '../VariablesRow.vue';
import VariablesRow from './VariablesRow.vue';
import { fireEvent } from '@testing-library/vue';
import { setupServer } from '@/__tests__/server';
import { afterAll, beforeAll } from 'vitest';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`ChangePasswordModal > should render correctly 1`] = `
"<!--teleport start-->
<!--teleport end-->"
`;
Loading

0 comments on commit 7e58fc4

Please sign in to comment.