diff --git a/CHANGELOG.md b/CHANGELOG.md index 16379d97..14315ef0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org). +## [Unreleased] +### Added +* *Nothing* + +### Changed +* [#781](https://github.com/shlinkio/shlink-web-client/issues/781) Migrate tests from jest to vitest. + +### Deprecated +* *Nothing* + +### Removed +* *Nothing* + +### Fixed +* *Nothing* + + ## [3.10.1] - 2023-04-23 ### Added * *Nothing* diff --git a/config/test/setupTests.ts b/config/test/setupTests.ts index 7dfb97b9..e6a1f665 100644 --- a/config/test/setupTests.ts +++ b/config/test/setupTests.ts @@ -1,16 +1,23 @@ import 'vitest-canvas-mock'; import 'chart.js/auto'; +import type { TestingLibraryMatchers } from '@testing-library/jest-dom/matchers'; import matchers from '@testing-library/jest-dom/matchers'; import { cleanup } from '@testing-library/react'; -import { setAutoFreeze } from 'immer'; import ResizeObserver from 'resize-observer-polyfill'; import { afterEach, expect } from 'vitest'; -// extends Vitest's expect method with methods from react-testing-library +// Workaround for TypeScript error: https://github.com/testing-library/jest-dom/issues/439#issuecomment-1536524120 +declare module 'vitest' { + interface Assertion extends jest.Matchers, TestingLibraryMatchers {} +} + +// Extends Vitest's expect method with methods from react-testing-library expect.extend(matchers); -// runs a cleanup after each test case (e.g. clearing jsdom) afterEach(() => { + // Clears all mocks after every test + vi.clearAllMocks(); + // runs a cleanup after each test case (e.g. clearing jsdom) cleanup(); }); @@ -18,5 +25,3 @@ afterEach(() => { (global as any).scrollTo = () => {}; (global as any).prompt = () => {}; (global as any).matchMedia = (media: string) => ({ matches: false, media }); - -setAutoFreeze(false); // TODO Bypassing a bug on jest diff --git a/package-lock.json b/package-lock.json index 527c9cb6..eb5f9a8e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,7 +55,7 @@ "@shlinkio/eslint-config-js-coding-standard": "~2.1.0", "@shlinkio/stylelint-config-css-coding-standard": "~1.0.1", "@testing-library/jest-dom": "^5.16.5", - "@testing-library/react": "^13.4.0", + "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^14.4.3", "@total-typescript/shoehorn": "^0.1.0", "@types/json2csv": "^5.0.3", @@ -74,7 +74,6 @@ "adm-zip": "^0.5.10", "chalk": "^5.2.0", "eslint": "^8.30.0", - "identity-obj-proxy": "^3.0.0", "jsdom": "^22.0.0", "resize-observer-polyfill": "^1.5.1", "sass": "^1.57.1", @@ -2695,21 +2694,22 @@ } }, "node_modules/@testing-library/dom": { - "version": "8.13.0", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-9.3.0.tgz", + "integrity": "sha512-Dffe68pGwI6WlLRYR2I0piIkyole9cSBH5jGQKCGMRpHW5RHCqAUaqc2Kv0tUyd4dU4DLPKhJIjyKOnjv4tuUw==", "dev": true, - "license": "MIT", "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", - "@types/aria-query": "^4.2.0", + "@types/aria-query": "^5.0.1", "aria-query": "^5.0.0", "chalk": "^4.1.0", "dom-accessibility-api": "^0.5.9", - "lz-string": "^1.4.4", + "lz-string": "^1.5.0", "pretty-format": "^27.0.2" }, "engines": { - "node": ">=12" + "node": ">=14" } }, "node_modules/@testing-library/dom/node_modules/ansi-styles": { @@ -2865,16 +2865,17 @@ } }, "node_modules/@testing-library/react": { - "version": "13.4.0", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-14.0.0.tgz", + "integrity": "sha512-S04gSNJbYE30TlIMLTzv6QCTzt9AqIF5y6s6SzVFILNcNvbV/jU96GeiTPillGQo+Ny64M/5PV7klNYYgv5Dfg==", "dev": true, - "license": "MIT", "dependencies": { "@babel/runtime": "^7.12.5", - "@testing-library/dom": "^8.5.0", + "@testing-library/dom": "^9.0.0", "@types/react-dom": "^18.0.0" }, "engines": { - "node": ">=12" + "node": ">=14" }, "peerDependencies": { "react": "^18.0.0", @@ -2908,9 +2909,10 @@ "dev": true }, "node_modules/@types/aria-query": { - "version": "4.2.2", - "dev": true, - "license": "MIT" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.1.tgz", + "integrity": "sha512-XTIieEY+gvJ39ChLcB4If5zHtPxt3Syj5rgZR+e1ctpmK8NjPf0zFqsz4JpLJT0xla9GFDKjy8Cpu331nrmE1Q==", + "dev": true }, "node_modules/@types/babel__core": { "version": "7.1.20", @@ -5984,11 +5986,6 @@ "node": ">=6" } }, - "node_modules/harmony-reflect": { - "version": "1.6.1", - "dev": true, - "license": "(Apache-2.0 OR MPL-1.1)" - }, "node_modules/has": { "version": "1.0.3", "license": "MIT", @@ -6162,17 +6159,6 @@ "version": "7.1.1", "license": "ISC" }, - "node_modules/identity-obj-proxy": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "harmony-reflect": "^1.4.6" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/ignore": { "version": "5.2.4", "dev": true, @@ -7327,9 +7313,10 @@ } }, "node_modules/lz-string": { - "version": "1.4.4", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", + "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", "dev": true, - "license": "WTFPL", "bin": { "lz-string": "bin/bin.js" } @@ -12283,16 +12270,18 @@ } }, "@testing-library/dom": { - "version": "8.13.0", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-9.3.0.tgz", + "integrity": "sha512-Dffe68pGwI6WlLRYR2I0piIkyole9cSBH5jGQKCGMRpHW5RHCqAUaqc2Kv0tUyd4dU4DLPKhJIjyKOnjv4tuUw==", "dev": true, "requires": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", - "@types/aria-query": "^4.2.0", + "@types/aria-query": "^5.0.1", "aria-query": "^5.0.0", "chalk": "^4.1.0", "dom-accessibility-api": "^0.5.9", - "lz-string": "^1.4.4", + "lz-string": "^1.5.0", "pretty-format": "^27.0.2" }, "dependencies": { @@ -12390,11 +12379,13 @@ } }, "@testing-library/react": { - "version": "13.4.0", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-14.0.0.tgz", + "integrity": "sha512-S04gSNJbYE30TlIMLTzv6QCTzt9AqIF5y6s6SzVFILNcNvbV/jU96GeiTPillGQo+Ny64M/5PV7klNYYgv5Dfg==", "dev": true, "requires": { "@babel/runtime": "^7.12.5", - "@testing-library/dom": "^8.5.0", + "@testing-library/dom": "^9.0.0", "@types/react-dom": "^18.0.0" } }, @@ -12414,7 +12405,9 @@ "dev": true }, "@types/aria-query": { - "version": "4.2.2", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.1.tgz", + "integrity": "sha512-XTIieEY+gvJ39ChLcB4If5zHtPxt3Syj5rgZR+e1ctpmK8NjPf0zFqsz4JpLJT0xla9GFDKjy8Cpu331nrmE1Q==", "dev": true }, "@types/babel__core": { @@ -14486,10 +14479,6 @@ "version": "2.1.0", "dev": true }, - "harmony-reflect": { - "version": "1.6.1", - "dev": true - }, "has": { "version": "1.0.3", "requires": { @@ -14594,13 +14583,6 @@ "idb": { "version": "7.1.1" }, - "identity-obj-proxy": { - "version": "3.0.0", - "dev": true, - "requires": { - "harmony-reflect": "^1.4.6" - } - }, "ignore": { "version": "5.2.4", "dev": true @@ -15321,7 +15303,9 @@ } }, "lz-string": { - "version": "1.4.4", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", + "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", "dev": true }, "magic-string": { diff --git a/package.json b/package.json index fa8e1f43..4863580f 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "@shlinkio/eslint-config-js-coding-standard": "~2.1.0", "@shlinkio/stylelint-config-css-coding-standard": "~1.0.1", "@testing-library/jest-dom": "^5.16.5", - "@testing-library/react": "^13.4.0", + "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^14.4.3", "@total-typescript/shoehorn": "^0.1.0", "@types/json2csv": "^5.0.3", @@ -91,7 +91,6 @@ "adm-zip": "^0.5.10", "chalk": "^5.2.0", "eslint": "^8.30.0", - "identity-obj-proxy": "^3.0.0", "jsdom": "^22.0.0", "resize-observer-polyfill": "^1.5.1", "sass": "^1.57.1", diff --git a/test/api/services/ShlinkApiClient.test.ts b/test/api/services/ShlinkApiClient.test.ts index 3cd1d781..f7818065 100644 --- a/test/api/services/ShlinkApiClient.test.ts +++ b/test/api/services/ShlinkApiClient.test.ts @@ -17,8 +17,6 @@ describe('ShlinkApiClient', () => { ['abc123', 'example.com'], ]; - beforeEach(vi.clearAllMocks); - describe('listShortUrls', () => { const expectedList = ['foo', 'bar']; diff --git a/test/app/App.test.tsx b/test/app/App.test.tsx index ca1b9bdb..70ad630a 100644 --- a/test/app/App.test.tsx +++ b/test/app/App.test.tsx @@ -32,8 +32,6 @@ describe('', () => { ); }; - afterEach(vi.clearAllMocks); - it('renders children components', () => { setUp(); diff --git a/test/common/AppUpdateBanner.test.tsx b/test/common/AppUpdateBanner.test.tsx index 83ded1e2..023ee27d 100644 --- a/test/common/AppUpdateBanner.test.tsx +++ b/test/common/AppUpdateBanner.test.tsx @@ -7,8 +7,6 @@ describe('', () => { const forceUpdate = vi.fn(); const setUp = () => renderWithEvents(); - afterEach(vi.clearAllMocks); - it('renders initial state', () => { setUp(); diff --git a/test/common/ErrorHandler.test.tsx b/test/common/ErrorHandler.test.tsx index 5fd40c21..4f4e8ef8 100644 --- a/test/common/ErrorHandler.test.tsx +++ b/test/common/ErrorHandler.test.tsx @@ -18,7 +18,6 @@ describe('', () => { beforeEach(() => { vi.spyOn(console, 'error').mockImplementation(() => {}); // Silence react errors }); - afterEach(vi.resetAllMocks); it('renders children when no error has occurred', () => { render(Foo} />); diff --git a/test/common/MenuLayout.test.tsx b/test/common/MenuLayout.test.tsx index 02e64c6c..a916c47d 100644 --- a/test/common/MenuLayout.test.tsx +++ b/test/common/MenuLayout.test.tsx @@ -44,8 +44,6 @@ describe('', () => { (useParams as any).mockReturnValue({ serverId: 'abc123' }); }); - afterEach(vi.clearAllMocks); - it('shows loading indicator while loading server', () => { setUp(null); diff --git a/test/common/services/HttpClient.test.ts b/test/common/services/HttpClient.test.ts index 43b13ac4..b815d835 100644 --- a/test/common/services/HttpClient.test.ts +++ b/test/common/services/HttpClient.test.ts @@ -4,8 +4,6 @@ describe('HttpClient', () => { const fetch = vi.fn(); const httpClient = new HttpClient(fetch); - beforeEach(vi.clearAllMocks); - describe('fetchJson', () => { it('throws json on success', async () => { const theError = { error: true, foo: 'bar' }; diff --git a/test/common/services/ReportExporter.test.ts b/test/common/services/ReportExporter.test.ts index 5dfa9cc8..7da43313 100644 --- a/test/common/services/ReportExporter.test.ts +++ b/test/common/services/ReportExporter.test.ts @@ -7,7 +7,6 @@ describe('ReportExporter', () => { const jsonToCsv = vi.fn(); let exporter: ReportExporter; - beforeEach(vi.clearAllMocks); beforeEach(() => { (global as any).Blob = class Blob {}; (global as any).URL = { createObjectURL: () => '' }; diff --git a/test/domains/DomainSelector.test.tsx b/test/domains/DomainSelector.test.tsx index 5efd8ef1..c683672d 100644 --- a/test/domains/DomainSelector.test.tsx +++ b/test/domains/DomainSelector.test.tsx @@ -16,8 +16,6 @@ describe('', () => { , ); - afterEach(vi.clearAllMocks); - it.each([ ['', 'Domain', 'domains-dropdown__toggle-btn'], ['my-domain.com', 'Domain: my-domain.com', 'domains-dropdown__toggle-btn--active'], diff --git a/test/domains/ManageDomains.test.tsx b/test/domains/ManageDomains.test.tsx index fada56ae..6eba6b79 100644 --- a/test/domains/ManageDomains.test.tsx +++ b/test/domains/ManageDomains.test.tsx @@ -20,8 +20,6 @@ describe('', () => { />, ); - afterEach(vi.clearAllMocks); - it('shows loading message while domains are loading', () => { setUp(fromPartial({ loading: true, filteredDomains: [] })); diff --git a/test/domains/helpers/DomainDropdown.test.tsx b/test/domains/helpers/DomainDropdown.test.tsx index a5c2ecd3..85c72326 100644 --- a/test/domains/helpers/DomainDropdown.test.tsx +++ b/test/domains/helpers/DomainDropdown.test.tsx @@ -19,8 +19,6 @@ describe('', () => { , ); - afterEach(vi.clearAllMocks); - it('renders expected menu items', () => { setUp(); diff --git a/test/domains/helpers/DomainStatusIcon.test.tsx b/test/domains/helpers/DomainStatusIcon.test.tsx index b1ee76bd..458f2130 100644 --- a/test/domains/helpers/DomainStatusIcon.test.tsx +++ b/test/domains/helpers/DomainStatusIcon.test.tsx @@ -10,8 +10,6 @@ describe('', () => { , ); - beforeEach(vi.clearAllMocks); - it.each([ ['validating' as DomainStatus], ['invalid' as DomainStatus], diff --git a/test/domains/helpers/EditDomainRedirectsModal.test.tsx b/test/domains/helpers/EditDomainRedirectsModal.test.tsx index becf839b..8173a8ce 100644 --- a/test/domains/helpers/EditDomainRedirectsModal.test.tsx +++ b/test/domains/helpers/EditDomainRedirectsModal.test.tsx @@ -17,8 +17,6 @@ describe('', () => { , ); - afterEach(vi.clearAllMocks); - it('renders domain in header', () => { setUp(); expect(screen.getByRole('heading')).toHaveTextContent('Edit redirects for foo.com'); diff --git a/test/domains/reducers/domainRedirects.test.ts b/test/domains/reducers/domainRedirects.test.ts index e7e3bb0b..996e8f4a 100644 --- a/test/domains/reducers/domainRedirects.test.ts +++ b/test/domains/reducers/domainRedirects.test.ts @@ -4,8 +4,6 @@ import type { ShlinkDomainRedirects } from '../../../src/api/types'; import { editDomainRedirects } from '../../../src/domains/reducers/domainRedirects'; describe('domainRedirectsReducer', () => { - beforeEach(vi.clearAllMocks); - describe('editDomainRedirects', () => { const domain = 'example.com'; const redirects = fromPartial({}); diff --git a/test/domains/reducers/domainsList.test.ts b/test/domains/reducers/domainsList.test.ts index afadeca8..95d3de2d 100644 --- a/test/domains/reducers/domainsList.test.ts +++ b/test/domains/reducers/domainsList.test.ts @@ -30,8 +30,6 @@ describe('domainsListReducer', () => { editDomainRedirectsThunk, ); - beforeEach(vi.clearAllMocks); - describe('reducer', () => { it('returns loading on LIST_DOMAINS_START', () => { expect(reducer(undefined, listDomainsAction.pending(''))).toEqual( diff --git a/test/mercure/helpers/index.test.tsx b/test/mercure/helpers/index.test.tsx index 12fee3d2..0d620272 100644 --- a/test/mercure/helpers/index.test.tsx +++ b/test/mercure/helpers/index.test.tsx @@ -7,8 +7,6 @@ import type { MercureInfo } from '../../../src/mercure/reducers/mercureInfo'; vi.mock('event-source-polyfill'); describe('helpers', () => { - afterEach(vi.resetAllMocks); - describe('bindToMercureTopic', () => { const onMessage = vi.fn(); const onTokenExpired = vi.fn(); diff --git a/test/mercure/reducers/mercureInfo.test.ts b/test/mercure/reducers/mercureInfo.test.ts index 1079f7d1..2e1f0b45 100644 --- a/test/mercure/reducers/mercureInfo.test.ts +++ b/test/mercure/reducers/mercureInfo.test.ts @@ -12,8 +12,6 @@ describe('mercureInfoReducer', () => { const buildShlinkApiClient = () => fromPartial({ mercureInfo: getMercureInfo }); const { loadMercureInfo, reducer } = mercureInfoReducerCreator(buildShlinkApiClient); - beforeEach(vi.resetAllMocks); - describe('reducer', () => { it('returns loading on GET_MERCURE_INFO_START', () => { expect(reducer(undefined, loadMercureInfo.pending(''))).toEqual({ diff --git a/test/servers/CreateServer.test.tsx b/test/servers/CreateServer.test.tsx index 0af5591f..27a54a20 100644 --- a/test/servers/CreateServer.test.tsx +++ b/test/servers/CreateServer.test.tsx @@ -28,8 +28,6 @@ describe('', () => { return renderWithEvents(); }; - beforeEach(vi.clearAllMocks); - it('shows success message when imported is true', () => { setUp(true); diff --git a/test/servers/DeleteServerModal.test.tsx b/test/servers/DeleteServerModal.test.tsx index ab2bf43d..c2f7b334 100644 --- a/test/servers/DeleteServerModal.test.tsx +++ b/test/servers/DeleteServerModal.test.tsx @@ -30,8 +30,6 @@ describe('', () => { ); }; - afterEach(vi.clearAllMocks); - it('renders a modal window', () => { setUp(); diff --git a/test/servers/EditServer.test.tsx b/test/servers/EditServer.test.tsx index 17d5b3ad..44ceeec5 100644 --- a/test/servers/EditServer.test.tsx +++ b/test/servers/EditServer.test.tsx @@ -31,8 +31,6 @@ describe('', () => { (useNavigate as any).mockReturnValue(navigate); }); - afterEach(vi.clearAllMocks); - it('renders nothing if selected server is not reachable', () => { setUp(fromPartial({})); diff --git a/test/servers/ManageServers.test.tsx b/test/servers/ManageServers.test.tsx index 3e61c34a..ce01fc80 100644 --- a/test/servers/ManageServers.test.tsx +++ b/test/servers/ManageServers.test.tsx @@ -23,8 +23,6 @@ describe('', () => { , ); - afterEach(vi.clearAllMocks); - it('shows search field which allows searching servers, affecting te amount of rendered rows', async () => { const { user } = setUp({ foo: createServerMock('foo'), diff --git a/test/servers/ManageServersRowDropdown.test.tsx b/test/servers/ManageServersRowDropdown.test.tsx index 53064f81..6825cb5e 100644 --- a/test/servers/ManageServersRowDropdown.test.tsx +++ b/test/servers/ManageServersRowDropdown.test.tsx @@ -19,8 +19,6 @@ describe('', () => { ); }; - afterEach(vi.clearAllMocks); - it('renders expected amount of dropdown items', async () => { const { user } = setUp(); diff --git a/test/servers/helpers/DuplicatedServersModal.test.tsx b/test/servers/helpers/DuplicatedServersModal.test.tsx index 8d88b844..36bf29af 100644 --- a/test/servers/helpers/DuplicatedServersModal.test.tsx +++ b/test/servers/helpers/DuplicatedServersModal.test.tsx @@ -12,8 +12,6 @@ describe('', () => { ); const mockServer = (data: Partial = {}) => fromPartial(data); - beforeEach(vi.clearAllMocks); - it.each([ [[], 0], [[mockServer()], 2], diff --git a/test/servers/helpers/ImportServersBtn.test.tsx b/test/servers/helpers/ImportServersBtn.test.tsx index 69f004ad..44f0c08a 100644 --- a/test/servers/helpers/ImportServersBtn.test.tsx +++ b/test/servers/helpers/ImportServersBtn.test.tsx @@ -24,8 +24,6 @@ describe('', () => { />, ); - afterEach(vi.clearAllMocks); - it('shows tooltip on button hover', async () => { const { user } = setUp(); diff --git a/test/servers/helpers/ServerForm.test.tsx b/test/servers/helpers/ServerForm.test.tsx index 088417f5..8373a823 100644 --- a/test/servers/helpers/ServerForm.test.tsx +++ b/test/servers/helpers/ServerForm.test.tsx @@ -5,8 +5,6 @@ describe('', () => { const onSubmit = vi.fn(); const setUp = () => render(Something); - afterEach(vi.resetAllMocks); - it('renders components', () => { setUp(); diff --git a/test/servers/reducers/remoteServers.test.ts b/test/servers/reducers/remoteServers.test.ts index fef79208..40bcd6f7 100644 --- a/test/servers/reducers/remoteServers.test.ts +++ b/test/servers/reducers/remoteServers.test.ts @@ -3,8 +3,6 @@ import type { HttpClient } from '../../../src/common/services/HttpClient'; import { fetchServers } from '../../../src/servers/reducers/remoteServers'; describe('remoteServersReducer', () => { - afterEach(vi.clearAllMocks); - describe('fetchServers', () => { const dispatch = vi.fn(); const fetchJson = vi.fn(); diff --git a/test/servers/reducers/selectedServer.test.ts b/test/servers/reducers/selectedServer.test.ts index b1818347..689b71e2 100644 --- a/test/servers/reducers/selectedServer.test.ts +++ b/test/servers/reducers/selectedServer.test.ts @@ -19,8 +19,6 @@ describe('selectedServerReducer', () => { const selectServer = selectServerCreator(buildApiClient); const { reducer } = selectedServerReducerCreator(selectServer); - afterEach(vi.clearAllMocks); - describe('reducer', () => { it('returns default when action is RESET_SELECTED_SERVER', () => expect(reducer(null, resetSelectedServer())).toBeNull()); diff --git a/test/servers/reducers/servers.test.ts b/test/servers/reducers/servers.test.ts index 890430df..e88c24bc 100644 --- a/test/servers/reducers/servers.test.ts +++ b/test/servers/reducers/servers.test.ts @@ -15,8 +15,6 @@ describe('serversReducer', () => { def456: fromPartial({ id: 'def456' }), }; - afterEach(vi.clearAllMocks); - describe('reducer', () => { it('returns edited server when action is EDIT_SERVER', () => expect(serversReducer(list, editServer('abc123', { name: 'foo' }))).toEqual({ diff --git a/test/servers/services/ServersExporter.test.ts b/test/servers/services/ServersExporter.test.ts index c077965f..75054e89 100644 --- a/test/servers/services/ServersExporter.test.ts +++ b/test/servers/services/ServersExporter.test.ts @@ -23,8 +23,6 @@ describe('ServersExporter', () => { }); const createCsvjsonMock = (throwError = false) => (throwError ? erroneousToCsv : vi.fn(() => '')); - beforeEach(vi.clearAllMocks); - describe('exportServers', () => { let originalConsole: Console; const error = vi.fn(); diff --git a/test/servers/services/ServersImporter.test.ts b/test/servers/services/ServersImporter.test.ts index f9554fa6..7f457c30 100644 --- a/test/servers/services/ServersImporter.test.ts +++ b/test/servers/services/ServersImporter.test.ts @@ -14,8 +14,6 @@ describe('ServersImporter', () => { }); const importer = new ServersImporter(csvjsonMock, () => fileReaderMock); - beforeEach(vi.clearAllMocks); - describe('importServersFromFile', () => { it('rejects with error if no file was provided', async () => { await expect(importer.importServersFromFile()).rejects.toEqual( diff --git a/test/settings/RealTimeUpdatesSettings.test.tsx b/test/settings/RealTimeUpdatesSettings.test.tsx index 33e3da1b..86815061 100644 --- a/test/settings/RealTimeUpdatesSettings.test.tsx +++ b/test/settings/RealTimeUpdatesSettings.test.tsx @@ -17,8 +17,6 @@ describe('', () => { />, ); - afterEach(vi.clearAllMocks); - it('renders enabled real time updates as expected', () => { setUp({ enabled: true }); diff --git a/test/settings/ShortUrlCreationSettings.test.tsx b/test/settings/ShortUrlCreationSettings.test.tsx index b1e1556e..da21d4d3 100644 --- a/test/settings/ShortUrlCreationSettings.test.tsx +++ b/test/settings/ShortUrlCreationSettings.test.tsx @@ -13,8 +13,6 @@ describe('', () => { />, ); - afterEach(vi.clearAllMocks); - it.each([ [{ validateUrls: true }, true], [{ validateUrls: false }, false], diff --git a/test/settings/ShortUrlsListSettings.test.tsx b/test/settings/ShortUrlsListSettings.test.tsx index 70b13942..3f0ef90b 100644 --- a/test/settings/ShortUrlsListSettings.test.tsx +++ b/test/settings/ShortUrlsListSettings.test.tsx @@ -11,8 +11,6 @@ describe('', () => { , ); - afterEach(vi.clearAllMocks); - it.each([ [undefined, 'Order by: Created at - DESC'], [{}, 'Order by: Created at - DESC'], diff --git a/test/settings/TagsSettings.test.tsx b/test/settings/TagsSettings.test.tsx index cf0d165a..0f171d0b 100644 --- a/test/settings/TagsSettings.test.tsx +++ b/test/settings/TagsSettings.test.tsx @@ -11,8 +11,6 @@ describe('', () => { , ); - afterEach(vi.clearAllMocks); - it('renders expected amount of groups', () => { setUp(); diff --git a/test/settings/UserInterfaceSettings.test.tsx b/test/settings/UserInterfaceSettings.test.tsx index dbf40d11..b8c8c618 100644 --- a/test/settings/UserInterfaceSettings.test.tsx +++ b/test/settings/UserInterfaceSettings.test.tsx @@ -11,8 +11,6 @@ describe('', () => { , ); - afterEach(vi.clearAllMocks); - it.each([ [{ theme: 'dark' as Theme }, true], [{ theme: 'light' as Theme }, false], diff --git a/test/settings/VisitsSettings.test.tsx b/test/settings/VisitsSettings.test.tsx index 2f9e01bf..960e60fe 100644 --- a/test/settings/VisitsSettings.test.tsx +++ b/test/settings/VisitsSettings.test.tsx @@ -10,8 +10,6 @@ describe('', () => { , ); - afterEach(vi.clearAllMocks); - it('renders expected components', () => { setUp(); diff --git a/test/short-urls/ShortUrlForm.test.tsx b/test/short-urls/ShortUrlForm.test.tsx index b8616e0e..6fa942ef 100644 --- a/test/short-urls/ShortUrlForm.test.tsx +++ b/test/short-urls/ShortUrlForm.test.tsx @@ -23,8 +23,6 @@ describe('', () => { />, ); - afterEach(vi.clearAllMocks); - it.each([ [ async (user: UserEvent) => { diff --git a/test/short-urls/ShortUrlsFilteringBar.test.tsx b/test/short-urls/ShortUrlsFilteringBar.test.tsx index ff2abb00..cec24dc7 100644 --- a/test/short-urls/ShortUrlsFilteringBar.test.tsx +++ b/test/short-urls/ShortUrlsFilteringBar.test.tsx @@ -36,8 +36,6 @@ describe('', () => { ); }; - afterEach(vi.clearAllMocks); - it('renders expected children components', () => { setUp(); diff --git a/test/short-urls/ShortUrlsList.test.tsx b/test/short-urls/ShortUrlsList.test.tsx index d3d9cb51..dd543635 100644 --- a/test/short-urls/ShortUrlsList.test.tsx +++ b/test/short-urls/ShortUrlsList.test.tsx @@ -51,8 +51,6 @@ describe('', () => { (useNavigate as any).mockReturnValue(navigate); }); - afterEach(vi.clearAllMocks); - it('wraps expected components', () => { setUp(); diff --git a/test/short-urls/ShortUrlsTable.test.tsx b/test/short-urls/ShortUrlsTable.test.tsx index 4c4370cb..27a984c5 100644 --- a/test/short-urls/ShortUrlsTable.test.tsx +++ b/test/short-urls/ShortUrlsTable.test.tsx @@ -15,8 +15,6 @@ describe('', () => { orderByColumn} />, ); - afterEach(vi.resetAllMocks); - it('should render inner table by default', () => { setUp(); expect(screen.getByRole('table')).toBeInTheDocument(); diff --git a/test/short-urls/helpers/CreateShortUrlResult.test.tsx b/test/short-urls/helpers/CreateShortUrlResult.test.tsx index 62f11705..d06c4e92 100644 --- a/test/short-urls/helpers/CreateShortUrlResult.test.tsx +++ b/test/short-urls/helpers/CreateShortUrlResult.test.tsx @@ -13,8 +13,6 @@ describe('', () => { {}} creation={creation} />, ); - afterEach(vi.clearAllMocks); - it('renders an error when error is true', () => { setUp({ error: true, saved: false, saving: false }); expect(screen.getByText('An error occurred while creating the URL :(')).toBeInTheDocument(); diff --git a/test/short-urls/helpers/DeleteShortUrlModal.test.tsx b/test/short-urls/helpers/DeleteShortUrlModal.test.tsx index 964c8207..c93d094a 100644 --- a/test/short-urls/helpers/DeleteShortUrlModal.test.tsx +++ b/test/short-urls/helpers/DeleteShortUrlModal.test.tsx @@ -31,8 +31,6 @@ describe('', () => { />, ); - afterEach(vi.clearAllMocks); - it('shows generic error when non-threshold error occurs', () => { setUp({ loading: false, diff --git a/test/short-urls/helpers/ExportShortUrlsBtn.test.tsx b/test/short-urls/helpers/ExportShortUrlsBtn.test.tsx index 0a9dee10..66d74e81 100644 --- a/test/short-urls/helpers/ExportShortUrlsBtn.test.tsx +++ b/test/short-urls/helpers/ExportShortUrlsBtn.test.tsx @@ -19,8 +19,6 @@ describe('', () => { , ); - afterEach(vi.clearAllMocks); - it.each([ [undefined, '0'], [1, '1'], diff --git a/test/short-urls/helpers/QrCodeModal.test.tsx b/test/short-urls/helpers/QrCodeModal.test.tsx index abbcad21..f80873a8 100644 --- a/test/short-urls/helpers/QrCodeModal.test.tsx +++ b/test/short-urls/helpers/QrCodeModal.test.tsx @@ -17,8 +17,6 @@ describe('', () => { />, ); - afterEach(vi.clearAllMocks); - it('shows an external link to the URL in the header', () => { setUp(); const externalLink = screen.getByRole('heading').querySelector('a'); diff --git a/test/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown.test.tsx b/test/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown.test.tsx index 2c19f380..5c5f3927 100644 --- a/test/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown.test.tsx +++ b/test/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown.test.tsx @@ -10,8 +10,6 @@ describe('', () => { , ); - afterEach(vi.clearAllMocks); - it('renders initial state', async () => { const { user } = setUp(); const btn = screen.getByRole('button'); diff --git a/test/short-urls/helpers/qr-codes/QrFormatDropdown.test.tsx b/test/short-urls/helpers/qr-codes/QrFormatDropdown.test.tsx index 657b672a..840f24ea 100644 --- a/test/short-urls/helpers/qr-codes/QrFormatDropdown.test.tsx +++ b/test/short-urls/helpers/qr-codes/QrFormatDropdown.test.tsx @@ -8,8 +8,6 @@ describe('', () => { const setFormat = vi.fn(); const setUp = () => renderWithEvents(); - afterEach(vi.clearAllMocks); - it('renders initial state', async () => { const { user } = setUp(); const btn = screen.getByRole('button'); diff --git a/test/short-urls/reducers/shortUrlCreation.test.ts b/test/short-urls/reducers/shortUrlCreation.test.ts index 09107540..da9c38bf 100644 --- a/test/short-urls/reducers/shortUrlCreation.test.ts +++ b/test/short-urls/reducers/shortUrlCreation.test.ts @@ -14,8 +14,6 @@ describe('shortUrlCreationReducer', () => { const createShortUrl = createShortUrlCreator(buildShlinkApiClient); const { reducer, resetCreateShortUrl } = shortUrlCreationReducerCreator(createShortUrl); - afterEach(vi.resetAllMocks); - describe('reducer', () => { it('returns loading on CREATE_SHORT_URL_START', () => { expect(reducer(undefined, createShortUrl.pending('', fromPartial({})))).toEqual({ diff --git a/test/short-urls/reducers/shortUrlDeletion.test.ts b/test/short-urls/reducers/shortUrlDeletion.test.ts index 0ee97d34..3c957d25 100644 --- a/test/short-urls/reducers/shortUrlDeletion.test.ts +++ b/test/short-urls/reducers/shortUrlDeletion.test.ts @@ -12,8 +12,6 @@ describe('shortUrlDeletionReducer', () => { const deleteShortUrl = deleteShortUrlCreator(buildShlinkApiClient); const { reducer, resetDeleteShortUrl } = shortUrlDeletionReducerCreator(deleteShortUrl); - beforeEach(vi.clearAllMocks); - describe('reducer', () => { it('returns loading on DELETE_SHORT_URL_START', () => expect(reducer(undefined, deleteShortUrl.pending('', { shortCode: '' }))).toEqual({ diff --git a/test/short-urls/reducers/shortUrlDetail.test.ts b/test/short-urls/reducers/shortUrlDetail.test.ts index 97b5e177..34817e5d 100644 --- a/test/short-urls/reducers/shortUrlDetail.test.ts +++ b/test/short-urls/reducers/shortUrlDetail.test.ts @@ -10,8 +10,6 @@ describe('shortUrlDetailReducer', () => { const buildShlinkApiClient = () => fromPartial({ getShortUrl: getShortUrlCall }); const { reducer, getShortUrlDetail } = shortUrlDetailReducerCreator(buildShlinkApiClient); - beforeEach(vi.clearAllMocks); - describe('reducer', () => { it('returns loading on GET_SHORT_URL_DETAIL_START', () => { const { loading } = reducer({ loading: false, error: false }, getShortUrlDetail.pending('', { shortCode: '' })); diff --git a/test/short-urls/reducers/shortUrlEdition.test.ts b/test/short-urls/reducers/shortUrlEdition.test.ts index b00c53d7..7adcd813 100644 --- a/test/short-urls/reducers/shortUrlEdition.test.ts +++ b/test/short-urls/reducers/shortUrlEdition.test.ts @@ -16,8 +16,6 @@ describe('shortUrlEditionReducer', () => { const editShortUrl = editShortUrlCreator(buildShlinkApiClient); const { reducer } = shortUrlEditionReducerCreator(editShortUrl); - afterEach(vi.clearAllMocks); - describe('reducer', () => { it('returns loading on EDIT_SHORT_URL_START', () => { expect(reducer(undefined, editShortUrl.pending('', fromPartial({})))).toEqual({ @@ -51,8 +49,6 @@ describe('shortUrlEditionReducer', () => { selectedServer, }); - afterEach(vi.clearAllMocks); - it.each([[undefined], [null], ['example.com']])('dispatches short URL on success', async (domain) => { await editShortUrl({ shortCode, domain, data: { longUrl } })(dispatch, createGetState(), {}); diff --git a/test/short-urls/reducers/shortUrlsList.test.ts b/test/short-urls/reducers/shortUrlsList.test.ts index f5dba798..abcac9ec 100644 --- a/test/short-urls/reducers/shortUrlsList.test.ts +++ b/test/short-urls/reducers/shortUrlsList.test.ts @@ -21,8 +21,6 @@ describe('shortUrlsListReducer', () => { const createShortUrl = createShortUrlCreator(buildShlinkApiClient); const { reducer } = shortUrlsListReducerCreator(listShortUrls, editShortUrl, createShortUrl); - afterEach(vi.clearAllMocks); - describe('reducer', () => { it('returns loading on LIST_SHORT_URLS_START', () => expect(reducer(undefined, listShortUrls.pending(''))).toEqual({ diff --git a/test/tags/TagsList.test.tsx b/test/tags/TagsList.test.tsx index 4d79823d..d53e52d4 100644 --- a/test/tags/TagsList.test.tsx +++ b/test/tags/TagsList.test.tsx @@ -21,8 +21,6 @@ describe('', () => { />, ); - afterEach(vi.clearAllMocks); - it('shows a loading message when tags are being loaded', () => { setUp({ loading: true }); diff --git a/test/tags/TagsTable.test.tsx b/test/tags/TagsTable.test.tsx index fcf82063..d804e264 100644 --- a/test/tags/TagsTable.test.tsx +++ b/test/tags/TagsTable.test.tsx @@ -26,7 +26,9 @@ describe('', () => { ); }; - afterEach(vi.clearAllMocks); + afterEach(() => { + vi.clearAllMocks(); + }); it('renders empty result if there are no tags', () => { setUp(); diff --git a/test/tags/helpers/DeleteTagConfirmModal.test.tsx b/test/tags/helpers/DeleteTagConfirmModal.test.tsx index fc5fd1ec..03dfd732 100644 --- a/test/tags/helpers/DeleteTagConfirmModal.test.tsx +++ b/test/tags/helpers/DeleteTagConfirmModal.test.tsx @@ -18,8 +18,6 @@ describe('', () => { />, ); - afterEach(vi.resetAllMocks); - it('asks confirmation for provided tag to be deleted', () => { setUp({ error: false, deleted: false, deleting: false }); diff --git a/test/tags/helpers/EditTagModal.test.tsx b/test/tags/helpers/EditTagModal.test.tsx index d4262c53..91e57488 100644 --- a/test/tags/helpers/EditTagModal.test.tsx +++ b/test/tags/helpers/EditTagModal.test.tsx @@ -15,8 +15,6 @@ describe('', () => { ); }; - afterEach(vi.clearAllMocks); - it('allows modal to be toggled with different mechanisms', async () => { const { user } = setUp(); diff --git a/test/tags/helpers/Tag.test.tsx b/test/tags/helpers/Tag.test.tsx index 783775ed..a9088840 100644 --- a/test/tags/helpers/Tag.test.tsx +++ b/test/tags/helpers/Tag.test.tsx @@ -31,8 +31,6 @@ describe('', () => { , ); - afterEach(vi.clearAllMocks); - it.each([ [true], [false], diff --git a/test/tags/helpers/TagsSelector.test.tsx b/test/tags/helpers/TagsSelector.test.tsx index ad95f239..08bb3058 100644 --- a/test/tags/helpers/TagsSelector.test.tsx +++ b/test/tags/helpers/TagsSelector.test.tsx @@ -20,8 +20,6 @@ describe('', () => { />, ); - afterEach(vi.clearAllMocks); - it('has an input for tags', () => { setUp(); expect(screen.getByPlaceholderText('Add tags to the URL')).toBeInTheDocument(); diff --git a/test/tags/reducers/tagDelete.test.ts b/test/tags/reducers/tagDelete.test.ts index 38db9d88..eda74d29 100644 --- a/test/tags/reducers/tagDelete.test.ts +++ b/test/tags/reducers/tagDelete.test.ts @@ -8,8 +8,6 @@ describe('tagDeleteReducer', () => { const buildShlinkApiClient = () => fromPartial({ deleteTags: deleteTagsCall }); const { reducer, deleteTag } = tagDeleteReducerCreator(buildShlinkApiClient); - beforeEach(vi.clearAllMocks); - describe('reducer', () => { it('returns loading on DELETE_TAG_START', () => { expect(reducer(undefined, deleteTag.pending('', ''))).toEqual({ diff --git a/test/tags/reducers/tagEdit.test.ts b/test/tags/reducers/tagEdit.test.ts index cba58980..8e901c4c 100644 --- a/test/tags/reducers/tagEdit.test.ts +++ b/test/tags/reducers/tagEdit.test.ts @@ -53,8 +53,6 @@ describe('tagEditReducer', () => { const dispatch = vi.fn(); const getState = () => fromPartial({}); - afterEach(vi.clearAllMocks); - it('calls API on success', async () => { editTagCall.mockResolvedValue(undefined); diff --git a/test/tags/reducers/tagsList.test.ts b/test/tags/reducers/tagsList.test.ts index 230d024e..7e081e48 100644 --- a/test/tags/reducers/tagsList.test.ts +++ b/test/tags/reducers/tagsList.test.ts @@ -21,8 +21,6 @@ describe('tagsListReducer', () => { const createShortUrl = createShortUrlCreator(buildShlinkApiClient); const { reducer } = tagsListReducerCreator(listTags, createShortUrl); - afterEach(vi.clearAllMocks); - describe('reducer', () => { it('returns loading on LIST_TAGS_START', () => { expect(reducer(undefined, listTags.pending(''))).toEqual(expect.objectContaining({ diff --git a/test/utils/CopyToClipboardIcon.test.tsx b/test/utils/CopyToClipboardIcon.test.tsx index 2b0c625f..b73fa786 100644 --- a/test/utils/CopyToClipboardIcon.test.tsx +++ b/test/utils/CopyToClipboardIcon.test.tsx @@ -5,8 +5,6 @@ describe('', () => { const onCopy = vi.fn(); const setUp = (text = 'foo') => renderWithEvents(); - afterEach(vi.clearAllMocks); - it('wraps expected components', () => { const { container } = setUp(); expect(container).toMatchSnapshot(); diff --git a/test/utils/PaginationDropdown.test.tsx b/test/utils/PaginationDropdown.test.tsx index 03551714..a4188b56 100644 --- a/test/utils/PaginationDropdown.test.tsx +++ b/test/utils/PaginationDropdown.test.tsx @@ -13,8 +13,6 @@ describe('', () => { return result; }; - afterEach(vi.clearAllMocks); - it('renders expected amount of items', async () => { await setUp(); expect(screen.getAllByRole('menuitem')).toHaveLength(5); diff --git a/test/utils/dates/DateIntervalDropdownItems.test.tsx b/test/utils/dates/DateIntervalDropdownItems.test.tsx index fdede1c0..0a90769c 100644 --- a/test/utils/dates/DateIntervalDropdownItems.test.tsx +++ b/test/utils/dates/DateIntervalDropdownItems.test.tsx @@ -20,8 +20,6 @@ describe('', () => { return { user, ...renderResult }; }; - afterEach(vi.clearAllMocks); - it('renders expected amount of items', async () => { await setUp(); diff --git a/test/utils/dates/DateRangeRow.test.tsx b/test/utils/dates/DateRangeRow.test.tsx index 0f71f5af..85f05904 100644 --- a/test/utils/dates/DateRangeRow.test.tsx +++ b/test/utils/dates/DateRangeRow.test.tsx @@ -9,8 +9,6 @@ describe('', () => { , ); - afterEach(vi.clearAllMocks); - it('renders two date inputs', () => { setUp(); expect(screen.getAllByRole('textbox')).toHaveLength(2); diff --git a/test/utils/dates/DateRangeSelector.test.tsx b/test/utils/dates/DateRangeSelector.test.tsx index 09ee3c16..be8be592 100644 --- a/test/utils/dates/DateRangeSelector.test.tsx +++ b/test/utils/dates/DateRangeSelector.test.tsx @@ -22,8 +22,6 @@ describe('', () => { return result; }; - afterEach(vi.clearAllMocks); - it('renders proper amount of items', async () => { const { container } = await setUp(); diff --git a/test/visits/VisitsTable.test.tsx b/test/visits/VisitsTable.test.tsx index d35587f5..902a87e9 100644 --- a/test/visits/VisitsTable.test.tsx +++ b/test/visits/VisitsTable.test.tsx @@ -28,8 +28,6 @@ describe('', () => { ], }); - afterEach(vi.resetAllMocks); - it('renders expected amount of columns', () => { setUp([], []); expect(screen.getAllByRole('columnheader')).toHaveLength(8); diff --git a/test/visits/helpers/VisitsFilterDropdown.test.tsx b/test/visits/helpers/VisitsFilterDropdown.test.tsx index 2cab4ceb..113e0d66 100644 --- a/test/visits/helpers/VisitsFilterDropdown.test.tsx +++ b/test/visits/helpers/VisitsFilterDropdown.test.tsx @@ -13,8 +13,6 @@ describe('', () => { />, ); - beforeEach(vi.clearAllMocks); - it('has expected text', () => { setUp(); expect(screen.getByRole('button', { name: 'Filters' })).toBeInTheDocument(); diff --git a/test/visits/reducers/domainVisits.test.ts b/test/visits/reducers/domainVisits.test.ts index 2f4afcb9..3c434bc6 100644 --- a/test/visits/reducers/domainVisits.test.ts +++ b/test/visits/reducers/domainVisits.test.ts @@ -26,8 +26,6 @@ describe('domainVisitsReducer', () => { const getDomainVisits = getDomainVisitsCreator(buildApiClientMock); const { reducer, cancelGetVisits: cancelGetDomainVisits } = domainVisitsReducerCreator(getDomainVisits); - beforeEach(vi.clearAllMocks); - describe('reducer', () => { const buildState = (data: Partial) => fromPartial(data); diff --git a/test/visits/reducers/nonOrphanVisits.test.ts b/test/visits/reducers/nonOrphanVisits.test.ts index 39b62718..82c43924 100644 --- a/test/visits/reducers/nonOrphanVisits.test.ts +++ b/test/visits/reducers/nonOrphanVisits.test.ts @@ -22,8 +22,6 @@ describe('nonOrphanVisitsReducer', () => { const getNonOrphanVisits = getNonOrphanVisitsCreator(buildShlinkApiClient); const { reducer, cancelGetVisits: cancelGetNonOrphanVisits } = nonOrphanVisitsReducerCreator(getNonOrphanVisits); - beforeEach(vi.clearAllMocks); - describe('reducer', () => { const buildState = (data: Partial) => fromPartial(data); @@ -124,8 +122,6 @@ describe('nonOrphanVisitsReducer', () => { orphanVisits: { cancelLoad: false }, }); - beforeEach(vi.resetAllMocks); - it.each([ [undefined], [{}], diff --git a/test/visits/reducers/orphanVisits.test.ts b/test/visits/reducers/orphanVisits.test.ts index cd90fe41..9a8b5eec 100644 --- a/test/visits/reducers/orphanVisits.test.ts +++ b/test/visits/reducers/orphanVisits.test.ts @@ -22,8 +22,6 @@ describe('orphanVisitsReducer', () => { const getOrphanVisits = getOrphanVisitsCreator(buildShlinkApiClientMock); const { reducer, cancelGetVisits: cancelGetOrphanVisits } = orphanVisitsReducerCreator(getOrphanVisits); - beforeEach(vi.clearAllMocks); - describe('reducer', () => { const buildState = (data: Partial) => fromPartial(data); diff --git a/test/visits/reducers/shortUrlVisits.test.ts b/test/visits/reducers/shortUrlVisits.test.ts index 163f5cd1..0c87e5a3 100644 --- a/test/visits/reducers/shortUrlVisits.test.ts +++ b/test/visits/reducers/shortUrlVisits.test.ts @@ -23,8 +23,6 @@ describe('shortUrlVisitsReducer', () => { const getShortUrlVisits = getShortUrlVisitsCreator(buildApiClientMock); const { reducer, cancelGetVisits: cancelGetShortUrlVisits } = shortUrlVisitsReducerCreator(getShortUrlVisits); - beforeEach(vi.clearAllMocks); - describe('reducer', () => { const buildState = (data: Partial) => fromPartial(data); diff --git a/test/visits/reducers/tagVisits.test.ts b/test/visits/reducers/tagVisits.test.ts index 8a520653..a89804a6 100644 --- a/test/visits/reducers/tagVisits.test.ts +++ b/test/visits/reducers/tagVisits.test.ts @@ -23,8 +23,6 @@ describe('tagVisitsReducer', () => { const getTagVisits = getTagVisitsCreator(buildShlinkApiClientMock); const { reducer, cancelGetVisits: cancelGetTagVisits } = tagVisitsReducerCreator(getTagVisits); - beforeEach(vi.clearAllMocks); - describe('reducer', () => { const buildState = (data: Partial) => fromPartial(data); diff --git a/test/visits/reducers/visitsOverview.test.ts b/test/visits/reducers/visitsOverview.test.ts index b2bd0d48..29806a7f 100644 --- a/test/visits/reducers/visitsOverview.test.ts +++ b/test/visits/reducers/visitsOverview.test.ts @@ -19,8 +19,6 @@ describe('visitsOverviewReducer', () => { const loadVisitsOverview = loadVisitsOverviewCreator(buildApiClientMock); const { reducer } = visitsOverviewReducerCreator(loadVisitsOverview); - beforeEach(vi.clearAllMocks); - describe('reducer', () => { const state = (payload: Partial = {}) => fromPartial(payload); diff --git a/vite.config.ts b/vite.config.ts index 09cd8ee5..6a1bea03 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -41,10 +41,10 @@ export default defineConfig({ ], // Required code coverage. Lower than this will make the check fail - statements: 90, - branches: 80, - functions: 85, - lines: 90, + statements: 95, + branches: 90, + functions: 90, + lines: 95, }, deps: { inline: ['vitest-canvas-mock'],