Merge pull request #696 from acelaya-forks/feature/fix-tests

Feature/fix tests
This commit is contained in:
Alejandro Celaya 2022-08-07 13:14:56 +02:00 committed by GitHub
commit 4a92d0ff11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 4 deletions

View file

@ -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

View file

@ -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": {

View file

@ -14,7 +14,7 @@ describe('<ManageServers />', () => {
serversExporter,
() => <span>ImportServersBtn</span>,
useTimeoutToggle,
({ hasAutoConnect }) => <span>ManageServersRow {hasAutoConnect ? '[YES]' : '[NO]'}</span>,
({ hasAutoConnect }) => <tr><td>ManageServersRow {hasAutoConnect ? '[YES]' : '[NO]'}</td></tr>,
);
const createServerMock = (value: string, autoConnect = false) => Mock.of<ServerWithId>(
{ id: value, name: value, url: value, autoConnect },

View file

@ -59,6 +59,7 @@ describe('<ImportServersBtn />', () => {
input && fireEvent.change(input, { target: { files: [''] } });
expect(importServersFromFile).toHaveBeenCalledTimes(1);
await waitFor(() => expect(createServersMock).toHaveBeenCalledTimes(1));
});
it.each([

View file

@ -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('<DateRangeSelector />', () => {
);
await result.user.click(screen.getByRole('button'));
await waitFor(() => screen.getByRole('menu'));
return result;
};