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 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 }, 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([ 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; };