Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasikas committed Jun 28, 2024
1 parent cae03b1 commit f1deec3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import userEvent from '@testing-library/user-event';
import type { FormHook } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
import { useForm, Form } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
import { Tags } from './tags';
import type { CreateCaseFormSchema } from '../create/schema';
import { schema } from '../create/schema';
import type { AppMockRenderer } from '../../common/mock';
import { createAppMockRenderer, TestProviders } from '../../common/mock';
import { useGetTags } from '../../containers/use_get_tags';
import { MAX_LENGTH_PER_TAG } from '../../../common/constants';
import type { CaseFormFieldsSchemaProps } from './schema';

jest.mock('../../common/lib/kibana');
jest.mock('../../containers/use_get_tags');
Expand All @@ -30,7 +30,7 @@ describe('Tags', () => {
let appMockRender: AppMockRenderer;

const MockHookWrapperComponent: FC<PropsWithChildren<unknown>> = ({ children }) => {
const { form } = useForm<CreateCaseFormSchema>({
const { form } = useForm<CaseFormFieldsSchemaProps>({
defaultValue: { tags: [] },
schema: {
tags: schema.tags,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import { act } from '@testing-library/react';
import type { FormHook } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
import { useForm, Form } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
import { Title } from './title';
import type { CreateCaseFormSchema } from '../create/schema';
import { schema } from '../create/schema';
import type { CaseFormFieldsSchemaProps } from './schema';

describe('Title', () => {
let globalForm: FormHook;

const MockHookWrapperComponent: FC<PropsWithChildren<unknown>> = ({ children }) => {
const { form } = useForm<CreateCaseFormSchema>({
const { form } = useForm<CaseFormFieldsSchemaProps>({
defaultValue: { title: 'My title' },
schema: {
title: schema.title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import React, { useCallback } from 'react';
import { Form, useForm } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
import type { CreateCaseFormSchema } from './schema';
import { schema } from './schema';
import { usePostCase } from '../../containers/use_post_case';
import { usePostPushToService } from '../../containers/use_post_push_to_service';
Expand All @@ -21,6 +20,7 @@ import { useGetSupportedActionConnectors } from '../../containers/configure/use_
import { useCreateCaseWithAttachmentsTransaction } from '../../common/apm/use_cases_transactions';
import { useApplication } from '../../common/lib/kibana/use_application';
import { createFormSerializer, createFormDeserializer, getInitialCaseValue } from './utils';
import type { CaseFormFieldsSchemaProps } from '../case_form_fields/schema';

interface Props {
afterCaseCreated?: (
Expand Down Expand Up @@ -113,7 +113,7 @@ export const FormContext: React.FC<Props> = ({
options: { stripEmptyFields: false },
schema,
onSubmit: submitCase,
serializer: (data: CreateCaseFormSchema) =>
serializer: (data: CaseFormFieldsSchemaProps) =>
createFormSerializer(
connectors,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ describe('utils', () => {
connectorId: '',
fields: { incidentTypes: null, severityCode: null },
customFields: {},
syncAlerts: false,
};
const serializedFormData = {
title: 'title',
Expand Down

0 comments on commit f1deec3

Please sign in to comment.