From a3ab2c6e1b06b644f1f9ed70785762f325606513 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Wed, 3 Aug 2022 17:29:07 +0200 Subject: [PATCH 1/4] Fixed invalid DOM in ManageServers test --- package.json | 3 ++- test/servers/ManageServers.test.tsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 90dabbe2..c151625e 100644 --- a/package.json +++ b/package.json @@ -16,10 +16,11 @@ "build": "DISABLE_ESLINT_PLUGIN=true react-scripts build && node scripts/replace-version.mjs", "build:dist": "npm run build && node scripts/create-dist-file.mjs", "build:serve": "serve -p 5000 ./build", - "test": "jest --env=jsdom --colors --verbose", + "test": "jest --env=jsdom --colors", "test:coverage": "npm run test -- --coverage --coverageReporters=text --coverageReporters=text-summary", "test:ci": "npm run test:coverage -- --coverageReporters=clover --ci", "test:pretty": "npm run test:coverage -- --coverageReporters=html", + "test:verbose": "npm run test -- --verbose", "mutate": "./node_modules/.bin/stryker run --concurrency 4 --ignoreStatic" }, "dependencies": { diff --git a/test/servers/ManageServers.test.tsx b/test/servers/ManageServers.test.tsx index 520e5b4f..ddc32b53 100644 --- a/test/servers/ManageServers.test.tsx +++ b/test/servers/ManageServers.test.tsx @@ -14,7 +14,7 @@ describe('', () => { serversExporter, () => ImportServersBtn, useTimeoutToggle, - ({ hasAutoConnect }) => ManageServersRow {hasAutoConnect ? '[YES]' : '[NO]'}, + ({ hasAutoConnect }) => ManageServersRow {hasAutoConnect ? '[YES]' : '[NO]'}, ); const createServerMock = (value: string, autoConnect = false) => Mock.of( { id: value, name: value, url: value, autoConnect }, From c490835f9bfd66d0f159a145128f195561547bd0 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 7 Aug 2022 12:59:04 +0200 Subject: [PATCH 2/4] Ensured menu is displayed before asserting in DateRangeSelector test --- test/utils/dates/DateRangeSelector.test.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/utils/dates/DateRangeSelector.test.tsx b/test/utils/dates/DateRangeSelector.test.tsx index 868c03c0..c776cec9 100644 --- a/test/utils/dates/DateRangeSelector.test.tsx +++ b/test/utils/dates/DateRangeSelector.test.tsx @@ -1,4 +1,4 @@ -import { screen } from '@testing-library/react'; +import { screen, waitFor } from '@testing-library/react'; import { Mock } from 'ts-mockery'; import { DateRangeSelector, DateRangeSelectorProps } from '../../../src/utils/dates/DateRangeSelector'; import { DateInterval } from '../../../src/utils/dates/types'; @@ -16,6 +16,7 @@ describe('', () => { ); await result.user.click(screen.getByRole('button')); + await waitFor(() => screen.getByRole('menu')); return result; }; From 97cf3b26b0881557d150a43ef81a25ed38bb023d Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 7 Aug 2022 13:07:25 +0200 Subject: [PATCH 3/4] Fixed warning in ImportServersBtnTest --- test/servers/helpers/ImportServersBtn.test.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/test/servers/helpers/ImportServersBtn.test.tsx b/test/servers/helpers/ImportServersBtn.test.tsx index 605270fa..f60d21ad 100644 --- a/test/servers/helpers/ImportServersBtn.test.tsx +++ b/test/servers/helpers/ImportServersBtn.test.tsx @@ -59,6 +59,7 @@ describe('', () => { input && fireEvent.change(input, { target: { files: [''] } }); expect(importServersFromFile).toHaveBeenCalledTimes(1); + await waitFor(() => expect(createServersMock).toHaveBeenCalledTimes(1)); }); it.each([ From b37a983bde63ee542a9a5ae9f79b434b1a93431f Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 7 Aug 2022 13:09:59 +0200 Subject: [PATCH 4/4] Updated changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e8eafcf..56e8a16b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), * *Nothing* ### Fixed -* *Nothing* +* [#695](https://github.com/shlinkio/shlink-web-client/pull/695) Fixed some warnings in tests. ## [3.7.1] - 2022-05-25