From b68f69afa130105ff55ebb1b6c17db5f335620cb Mon Sep 17 00:00:00 2001 From: Crystal Lai Date: Mon, 22 Feb 2021 05:35:04 +0100 Subject: [PATCH] Test newly added queries --- .../web/graphql/__tests__/reportformats.js | 84 ++++++++++++++++++- gsa/src/web/graphql/__tests__/settings.js | 61 +++++++++++++- 2 files changed, 141 insertions(+), 4 deletions(-) diff --git a/gsa/src/web/graphql/__tests__/reportformats.js b/gsa/src/web/graphql/__tests__/reportformats.js index 286d719fd2..ab6ee69b20 100644 --- a/gsa/src/web/graphql/__tests__/reportformats.js +++ b/gsa/src/web/graphql/__tests__/reportformats.js @@ -18,8 +18,10 @@ /* eslint-disable react/prop-types */ import React from 'react'; -import {rendererWith, screen, wait} from 'web/utils/testing'; -import {useGetReportFormats} from '../reportformats'; +import {isDefined} from 'gmp/utils/identity'; + +import {fireEvent, rendererWith, screen, wait} from 'web/utils/testing'; +import {useGetReportFormats, useLazyGetReportFormats} from '../reportformats'; import {createGetReportFormatsQueryMock} from '../__mocks__/reportformats'; const GetReportFormatsComponent = () => { @@ -73,3 +75,81 @@ describe('useGetReportFormats tests', () => { expect(screen.getByTestId('length')).toHaveTextContent(2); }); }); + +const GetLazyReportFormatsComponent = () => { + const [ + getReportFormats, + {counts, loading, reportFormats}, + ] = useLazyGetReportFormats(); + + if (loading) { + return Loading; + } + return ( +
+