From b1d3d824cd71a62560da07d28cea9b018051b502 Mon Sep 17 00:00:00 2001 From: Kurund Jalmi Date: Fri, 24 Nov 2023 23:56:21 +0000 Subject: [PATCH] deepscan and test fixes --- src/containers/Template/Form/HSM/HSM.test.tsx | 28 ++++++++----------- src/containers/Template/Form/Template.tsx | 12 -------- 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/src/containers/Template/Form/HSM/HSM.test.tsx b/src/containers/Template/Form/HSM/HSM.test.tsx index 20ea17961..083ea5a70 100644 --- a/src/containers/Template/Form/HSM/HSM.test.tsx +++ b/src/containers/Template/Form/HSM/HSM.test.tsx @@ -55,23 +55,19 @@ describe('Add mode', () => { expect(queryByText('Message is required.')).toBeInTheDocument(); }); - // length validation is not working. Basically setting of - // text field value is not working hence, commenting - // below for now - - // fireEvent.change(container.querySelector('input[name="label"]') as HTMLInputElement, { - // target: { - // value: - // 'We are not allowing a really long title, and we should trigger validation for this.', - // }, - // }); + fireEvent.change(container.querySelector('input[name="label"]') as HTMLInputElement, { + target: { + value: + 'We are not allowing a really long title, and we should trigger validation for this.', + }, + }); - // await user.click(button); + await user.click(button); - // // we should still have 2 errors - // await waitFor(() => { - // expect(queryByText('Title length is too long.')).toBeInTheDocument(); - // expect(queryByText('Message is required.')).toBeInTheDocument(); - // }); + // we should still have 2 errors + await waitFor(() => { + expect(queryByText('Title length is too long.')).toBeInTheDocument(); + expect(queryByText('Message is required.')).toBeInTheDocument(); + }); }); }); diff --git a/src/containers/Template/Form/Template.tsx b/src/containers/Template/Form/Template.tsx index e0ee0a341..235a1b19a 100644 --- a/src/containers/Template/Form/Template.tsx +++ b/src/containers/Template/Form/Template.tsx @@ -227,18 +227,6 @@ const Template = ({ variables: { opts: { order: 'ASC' } }, }); - const [getSessionTemplates, { data: sessionTemplates, loading: sessionTemplateLoading }] = - useLazyQuery(FILTER_TEMPLATES, { - variables: { - filter: { languageId: language ? parseInt(language.id, 10) : null }, - opts: { - order: 'ASC', - limit: null, - offset: 0, - }, - }, - }); - const [getSessionTemplate, { data: template, loading: templateLoading }] = useLazyQuery(GET_TEMPLATE);