mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 17:40:23 +03:00
Merge pull request #696 from acelaya-forks/feature/fix-tests
Feature/fix tests
This commit is contained in:
commit
4a92d0ff11
5 changed files with 7 additions and 4 deletions
|
@ -18,7 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
* *Nothing*
|
* *Nothing*
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
* *Nothing*
|
* [#695](https://github.com/shlinkio/shlink-web-client/pull/695) Fixed some warnings in tests.
|
||||||
|
|
||||||
|
|
||||||
## [3.7.1] - 2022-05-25
|
## [3.7.1] - 2022-05-25
|
||||||
|
|
|
@ -16,10 +16,11 @@
|
||||||
"build": "DISABLE_ESLINT_PLUGIN=true react-scripts build && node scripts/replace-version.mjs",
|
"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:dist": "npm run build && node scripts/create-dist-file.mjs",
|
||||||
"build:serve": "serve -p 5000 ./build",
|
"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:coverage": "npm run test -- --coverage --coverageReporters=text --coverageReporters=text-summary",
|
||||||
"test:ci": "npm run test:coverage -- --coverageReporters=clover --ci",
|
"test:ci": "npm run test:coverage -- --coverageReporters=clover --ci",
|
||||||
"test:pretty": "npm run test:coverage -- --coverageReporters=html",
|
"test:pretty": "npm run test:coverage -- --coverageReporters=html",
|
||||||
|
"test:verbose": "npm run test -- --verbose",
|
||||||
"mutate": "./node_modules/.bin/stryker run --concurrency 4 --ignoreStatic"
|
"mutate": "./node_modules/.bin/stryker run --concurrency 4 --ignoreStatic"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -14,7 +14,7 @@ describe('<ManageServers />', () => {
|
||||||
serversExporter,
|
serversExporter,
|
||||||
() => <span>ImportServersBtn</span>,
|
() => <span>ImportServersBtn</span>,
|
||||||
useTimeoutToggle,
|
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>(
|
const createServerMock = (value: string, autoConnect = false) => Mock.of<ServerWithId>(
|
||||||
{ id: value, name: value, url: value, autoConnect },
|
{ id: value, name: value, url: value, autoConnect },
|
||||||
|
|
|
@ -59,6 +59,7 @@ describe('<ImportServersBtn />', () => {
|
||||||
|
|
||||||
input && fireEvent.change(input, { target: { files: [''] } });
|
input && fireEvent.change(input, { target: { files: [''] } });
|
||||||
expect(importServersFromFile).toHaveBeenCalledTimes(1);
|
expect(importServersFromFile).toHaveBeenCalledTimes(1);
|
||||||
|
await waitFor(() => expect(createServersMock).toHaveBeenCalledTimes(1));
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { screen } from '@testing-library/react';
|
import { screen, waitFor } from '@testing-library/react';
|
||||||
import { Mock } from 'ts-mockery';
|
import { Mock } from 'ts-mockery';
|
||||||
import { DateRangeSelector, DateRangeSelectorProps } from '../../../src/utils/dates/DateRangeSelector';
|
import { DateRangeSelector, DateRangeSelectorProps } from '../../../src/utils/dates/DateRangeSelector';
|
||||||
import { DateInterval } from '../../../src/utils/dates/types';
|
import { DateInterval } from '../../../src/utils/dates/types';
|
||||||
|
@ -16,6 +16,7 @@ describe('<DateRangeSelector />', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
await result.user.click(screen.getByRole('button'));
|
await result.user.click(screen.getByRole('button'));
|
||||||
|
await waitFor(() => screen.getByRole('menu'));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue