mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
fix: Fix ts errors in editor part2 (no-changelog) (#9566)
This commit is contained in:
parent
4b6e5f09e6
commit
400c005866
|
@ -18,9 +18,12 @@ vi.mock('@/stores/rbac.store', () => ({
|
|||
|
||||
describe('RBAC', () => {
|
||||
it('renders default slot when hasScope is true', async () => {
|
||||
vi.mocked(useRBACStore).mockImplementation(() => ({
|
||||
vi.mocked(useRBACStore).mockImplementation(
|
||||
() =>
|
||||
({
|
||||
hasScope: () => true,
|
||||
}));
|
||||
}) as unknown as ReturnType<typeof useRBACStore>,
|
||||
);
|
||||
|
||||
const wrapper = renderComponent({
|
||||
props: { scope: 'worfklow:list' },
|
||||
|
@ -34,9 +37,12 @@ describe('RBAC', () => {
|
|||
});
|
||||
|
||||
it('renders fallback slot when hasScope is false', async () => {
|
||||
vi.mocked(useRBACStore).mockImplementation(() => ({
|
||||
vi.mocked(useRBACStore).mockImplementation(
|
||||
() =>
|
||||
({
|
||||
hasScope: () => false,
|
||||
}));
|
||||
}) as unknown as ReturnType<typeof useRBACStore>,
|
||||
);
|
||||
|
||||
const wrapper = renderComponent({
|
||||
props: { scope: 'worfklow:list' },
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
import {
|
||||
DEFAULT_SETUP,
|
||||
MAPPING_COLUMNS_RESPONSE,
|
||||
NODE_PARAMETER_VALUES,
|
||||
UPDATED_SCHEMA,
|
||||
} from './utils/ResourceMapper.utils';
|
||||
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
|
||||
import { waitAllPromises } from '@/__tests__/utils';
|
||||
import * as workflowHelpers from '@/composables/useWorkflowHelpers';
|
||||
import ResourceMapper from '@/components/ResourceMapper/ResourceMapper.vue';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { createComponentRenderer } from '@/__tests__/render';
|
||||
import type { SpyInstance } from 'vitest';
|
||||
import type { MockInstance } from 'vitest';
|
||||
|
||||
let nodeTypeStore: ReturnType<typeof useNodeTypesStore>;
|
||||
let fetchFieldsSpy: SpyInstance;
|
||||
let resolveParameterSpy: SpyInstance;
|
||||
let fetchFieldsSpy: MockInstance;
|
||||
|
||||
const renderComponent = createComponentRenderer(ResourceMapper, DEFAULT_SETUP);
|
||||
|
||||
|
@ -24,9 +21,6 @@ describe('ResourceMapper.vue', () => {
|
|||
fetchFieldsSpy = vi
|
||||
.spyOn(nodeTypeStore, 'getResourceMapperFields')
|
||||
.mockResolvedValue(MAPPING_COLUMNS_RESPONSE);
|
||||
resolveParameterSpy = vi
|
||||
.spyOn(workflowHelpers, 'resolveRequiredParameters')
|
||||
.mockReturnValue(NODE_PARAMETER_VALUES);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
@ -198,7 +192,7 @@ describe('ResourceMapper.vue', () => {
|
|||
});
|
||||
|
||||
it('should render correct fields based on saved schema', async () => {
|
||||
const { getByTestId, queryAllByTestId } = renderComponent(
|
||||
const { getByTestId } = renderComponent(
|
||||
{
|
||||
props: {
|
||||
node: {
|
||||
|
|
|
@ -67,7 +67,7 @@ describe('RunDataSearch', () => {
|
|||
},
|
||||
});
|
||||
|
||||
const input = getByRole('textbox');
|
||||
const input = getByRole<HTMLInputElement>('textbox');
|
||||
|
||||
await userEvent.click(input);
|
||||
expect(emitted().focus).toHaveLength(1);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { vi } from 'vitest';
|
||||
import type { Mock, MockInstance } from 'vitest';
|
||||
import { createPinia, setActivePinia } from 'pinia';
|
||||
import { waitFor } from '@testing-library/vue';
|
||||
import type { ExecutionSummary } from 'n8n-workflow';
|
||||
|
@ -11,8 +11,8 @@ const renderComponent = createComponentRenderer(WorkflowPreview);
|
|||
|
||||
let pinia: ReturnType<typeof createPinia>;
|
||||
let executionsStore: ReturnType<typeof useExecutionsStore>;
|
||||
let postMessageSpy: vi.SpyInstance;
|
||||
let consoleErrorSpy: vi.SpyInstance;
|
||||
let postMessageSpy: Mock;
|
||||
let consoleErrorSpy: MockInstance;
|
||||
|
||||
const sendPostMessageCommand = (command: string) => {
|
||||
window.postMessage(`{"command":"${command}"}`, '*');
|
||||
|
|
|
@ -154,7 +154,6 @@ export const MAPPING_COLUMNS_RESPONSE: ResourceMapperFields = {
|
|||
{
|
||||
id: 'First name',
|
||||
displayName: 'First name',
|
||||
match: false,
|
||||
required: true,
|
||||
defaultMatch: false,
|
||||
display: true,
|
||||
|
@ -164,7 +163,6 @@ export const MAPPING_COLUMNS_RESPONSE: ResourceMapperFields = {
|
|||
{
|
||||
id: 'Last name',
|
||||
displayName: 'Last name',
|
||||
match: false,
|
||||
required: true,
|
||||
defaultMatch: false,
|
||||
display: true,
|
||||
|
@ -174,7 +172,6 @@ export const MAPPING_COLUMNS_RESPONSE: ResourceMapperFields = {
|
|||
{
|
||||
id: 'Username',
|
||||
displayName: 'Username',
|
||||
match: false,
|
||||
required: false,
|
||||
defaultMatch: false,
|
||||
display: true,
|
||||
|
@ -184,7 +181,6 @@ export const MAPPING_COLUMNS_RESPONSE: ResourceMapperFields = {
|
|||
{
|
||||
id: 'Address',
|
||||
displayName: 'Address',
|
||||
match: false,
|
||||
required: false,
|
||||
defaultMatch: false,
|
||||
display: true,
|
||||
|
@ -194,7 +190,6 @@ export const MAPPING_COLUMNS_RESPONSE: ResourceMapperFields = {
|
|||
{
|
||||
id: 'id',
|
||||
displayName: 'id',
|
||||
match: true,
|
||||
required: true,
|
||||
defaultMatch: true,
|
||||
display: true,
|
||||
|
|
Loading…
Reference in a new issue