diff --git a/shlink-web-component/test/__helpers__/TestModalWrapper.tsx b/shlink-web-component/test/__helpers__/TestModalWrapper.tsx new file mode 100644 index 00000000..a673827b --- /dev/null +++ b/shlink-web-component/test/__helpers__/TestModalWrapper.tsx @@ -0,0 +1,14 @@ +import type { FC, ReactElement } from 'react'; +import { useToggle } from '../../src/utils/helpers/hooks'; + +interface RenderModalArgs { + isOpen: boolean; + toggle: () => void; +} + +export const TestModalWrapper: FC<{ renderModal: (args: RenderModalArgs) => ReactElement }> = ( + { renderModal }, +) => { + const [isOpen, toggle] = useToggle(true); + return renderModal({ isOpen, toggle }); +}; diff --git a/shlink-web-component/test/__helpers__/setUpTest.ts b/shlink-web-component/test/__helpers__/setUpTest.ts new file mode 100644 index 00000000..5d125c73 --- /dev/null +++ b/shlink-web-component/test/__helpers__/setUpTest.ts @@ -0,0 +1,20 @@ +import { render } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import type { ReactElement } from 'react'; + +export const setUpCanvas = (element: ReactElement) => { + const result = render(element); + const { container } = result; + const getEvents = () => { + const context = container.querySelector('canvas')?.getContext('2d'); + // @ts-expect-error __getEvents is set by vitest-canvas-mock + return context?.__getEvents(); // eslint-disable-line no-underscore-dangle + }; + + return { ...result, events: getEvents(), getEvents }; +}; + +export const renderWithEvents = (element: ReactElement) => ({ + user: userEvent.setup(), + ...render(element), +}); diff --git a/shlink-web-component/test/__mocks__/Window.mock.ts b/shlink-web-component/test/__mocks__/Window.mock.ts new file mode 100644 index 00000000..8b718753 --- /dev/null +++ b/shlink-web-component/test/__mocks__/Window.mock.ts @@ -0,0 +1,18 @@ +import { fromAny, fromPartial } from '@total-typescript/shoehorn'; + +const createLinkMock = () => ({ + setAttribute: vi.fn(), + click: vi.fn(), + style: {}, +}); + +export const appendChild = vi.fn(); + +export const removeChild = vi.fn(); + +export const windowMock = fromPartial({ + document: fromAny({ + createElement: vi.fn(createLinkMock), + body: { appendChild, removeChild }, + }), +}); diff --git a/test/common/AsideMenu.test.tsx b/shlink-web-component/test/common/AsideMenu.test.tsx similarity index 89% rename from test/common/AsideMenu.test.tsx rename to shlink-web-component/test/common/AsideMenu.test.tsx index f12129a8..fac3fe61 100644 --- a/test/common/AsideMenu.test.tsx +++ b/shlink-web-component/test/common/AsideMenu.test.tsx @@ -1,7 +1,7 @@ import { render, screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { MemoryRouter } from 'react-router'; -import { AsideMenu } from '../../shlink-web-component/src/common/AsideMenu'; +import { AsideMenu } from '../../src/common/AsideMenu'; describe('', () => { const setUp = () => render( diff --git a/test/api/ShlinkApiError.test.tsx b/shlink-web-component/test/common/ShlinkApiError.test.tsx similarity index 88% rename from test/api/ShlinkApiError.test.tsx rename to shlink-web-component/test/common/ShlinkApiError.test.tsx index 23cb8dcd..ab299b54 100644 --- a/test/api/ShlinkApiError.test.tsx +++ b/shlink-web-component/test/common/ShlinkApiError.test.tsx @@ -1,9 +1,9 @@ import { render, screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; -import type { ShlinkApiErrorProps } from '../../shlink-web-component/src/common/ShlinkApiError'; -import { ShlinkApiError } from '../../shlink-web-component/src/common/ShlinkApiError'; import type { InvalidArgumentError, ProblemDetailsError } from '../../src/api/types/errors'; import { ErrorTypeV2, ErrorTypeV3 } from '../../src/api/types/errors'; +import type { ShlinkApiErrorProps } from '../../src/common/ShlinkApiError'; +import { ShlinkApiError } from '../../src/common/ShlinkApiError'; describe('', () => { const setUp = (props: ShlinkApiErrorProps) => render(); diff --git a/test/domains/DomainRow.test.tsx b/shlink-web-component/test/domains/DomainRow.test.tsx similarity index 95% rename from test/domains/DomainRow.test.tsx rename to shlink-web-component/test/domains/DomainRow.test.tsx index f66dce9e..f3d6bc3e 100644 --- a/test/domains/DomainRow.test.tsx +++ b/shlink-web-component/test/domains/DomainRow.test.tsx @@ -1,8 +1,8 @@ import { render, screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; -import type { Domain } from '../../shlink-web-component/src/domains/data'; -import { DomainRow } from '../../shlink-web-component/src/domains/DomainRow'; import type { ShlinkDomainRedirects } from '../../src/api/types'; +import type { Domain } from '../../src/domains/data'; +import { DomainRow } from '../../src/domains/DomainRow'; describe('', () => { const redirectsCombinations = [ diff --git a/test/domains/DomainSelector.test.tsx b/shlink-web-component/test/domains/DomainSelector.test.tsx similarity index 93% rename from test/domains/DomainSelector.test.tsx rename to shlink-web-component/test/domains/DomainSelector.test.tsx index db613f29..c683672d 100644 --- a/test/domains/DomainSelector.test.tsx +++ b/shlink-web-component/test/domains/DomainSelector.test.tsx @@ -1,7 +1,7 @@ import { screen, waitFor } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; -import { DomainSelector } from '../../shlink-web-component/src/domains/DomainSelector'; -import type { DomainsList } from '../../shlink-web-component/src/domains/reducers/domainsList'; +import { DomainSelector } from '../../src/domains/DomainSelector'; +import type { DomainsList } from '../../src/domains/reducers/domainsList'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/domains/ManageDomains.test.tsx b/shlink-web-component/test/domains/ManageDomains.test.tsx similarity index 88% rename from test/domains/ManageDomains.test.tsx rename to shlink-web-component/test/domains/ManageDomains.test.tsx index 3d733146..4f6050b8 100644 --- a/test/domains/ManageDomains.test.tsx +++ b/shlink-web-component/test/domains/ManageDomains.test.tsx @@ -1,9 +1,8 @@ import { screen, waitFor } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; -import { ManageDomains } from '../../shlink-web-component/src/domains/ManageDomains'; -import type { DomainsList } from '../../shlink-web-component/src/domains/reducers/domainsList'; -import type { ShlinkDomain } from '../../src/api/types'; -import type { ProblemDetailsError } from '../../src/api/types/errors'; +import type { ProblemDetailsError, ShlinkDomain } from '../../src/api-contract'; +import { ManageDomains } from '../../src/domains/ManageDomains'; +import type { DomainsList } from '../../src/domains/reducers/domainsList'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { @@ -16,7 +15,6 @@ describe('', () => { editDomainRedirects={vi.fn()} checkDomainHealth={vi.fn()} domainsList={domainsList} - selectedServer={fromPartial({})} />, ); diff --git a/test/domains/helpers/DomainDropdown.test.tsx b/shlink-web-component/test/domains/helpers/DomainDropdown.test.tsx similarity index 90% rename from test/domains/helpers/DomainDropdown.test.tsx rename to shlink-web-component/test/domains/helpers/DomainDropdown.test.tsx index 82667586..0895731a 100644 --- a/test/domains/helpers/DomainDropdown.test.tsx +++ b/shlink-web-component/test/domains/helpers/DomainDropdown.test.tsx @@ -1,10 +1,10 @@ import { screen, waitForElementToBeRemoved } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { MemoryRouter } from 'react-router-dom'; -import type { Domain } from '../../../shlink-web-component/src/domains/data'; -import { DomainDropdown } from '../../../shlink-web-component/src/domains/helpers/DomainDropdown'; -import type { SelectedServer } from '../../../src/servers/data'; -import type { SemVer } from '../../../src/utils/helpers/version'; +import type { SelectedServer } from '../../../../src/servers/data'; +import type { SemVer } from '../../../../src/utils/helpers/version'; +import type { Domain } from '../../../src/domains/data'; +import { DomainDropdown } from '../../../src/domains/helpers/DomainDropdown'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/domains/helpers/DomainStatusIcon.test.tsx b/shlink-web-component/test/domains/helpers/DomainStatusIcon.test.tsx similarity index 85% rename from test/domains/helpers/DomainStatusIcon.test.tsx rename to shlink-web-component/test/domains/helpers/DomainStatusIcon.test.tsx index 6fe7871c..458f2130 100644 --- a/test/domains/helpers/DomainStatusIcon.test.tsx +++ b/shlink-web-component/test/domains/helpers/DomainStatusIcon.test.tsx @@ -1,7 +1,7 @@ import { screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; -import type { DomainStatus } from '../../../shlink-web-component/src/domains/data'; -import { DomainStatusIcon } from '../../../shlink-web-component/src/domains/helpers/DomainStatusIcon'; +import type { DomainStatus } from '../../../src/domains/data'; +import { DomainStatusIcon } from '../../../src/domains/helpers/DomainStatusIcon'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/domains/helpers/EditDomainRedirectsModal.test.tsx b/shlink-web-component/test/domains/helpers/EditDomainRedirectsModal.test.tsx similarity index 94% rename from test/domains/helpers/EditDomainRedirectsModal.test.tsx rename to shlink-web-component/test/domains/helpers/EditDomainRedirectsModal.test.tsx index f03add38..2a505ad0 100644 --- a/test/domains/helpers/EditDomainRedirectsModal.test.tsx +++ b/shlink-web-component/test/domains/helpers/EditDomainRedirectsModal.test.tsx @@ -1,7 +1,7 @@ import { fireEvent, screen, waitFor } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; -import { EditDomainRedirectsModal } from '../../../shlink-web-component/src/domains/helpers/EditDomainRedirectsModal'; -import type { ShlinkDomain } from '../../../src/api/types'; +import type { ShlinkDomain } from '../../../src/api-contract'; +import { EditDomainRedirectsModal } from '../../../src/domains/helpers/EditDomainRedirectsModal'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/domains/helpers/__snapshots__/DomainStatusIcon.test.tsx.snap b/shlink-web-component/test/domains/helpers/__snapshots__/DomainStatusIcon.test.tsx.snap similarity index 100% rename from test/domains/helpers/__snapshots__/DomainStatusIcon.test.tsx.snap rename to shlink-web-component/test/domains/helpers/__snapshots__/DomainStatusIcon.test.tsx.snap diff --git a/test/domains/reducers/domainRedirects.test.ts b/shlink-web-component/test/domains/reducers/domainRedirects.test.ts similarity index 85% rename from test/domains/reducers/domainRedirects.test.ts rename to shlink-web-component/test/domains/reducers/domainRedirects.test.ts index c7f2469c..a0f8dd7f 100644 --- a/test/domains/reducers/domainRedirects.test.ts +++ b/shlink-web-component/test/domains/reducers/domainRedirects.test.ts @@ -1,7 +1,7 @@ import { fromPartial } from '@total-typescript/shoehorn'; -import { editDomainRedirects } from '../../../shlink-web-component/src/domains/reducers/domainRedirects'; -import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; +import type { ShlinkApiClient } from '../../../../src/api/services/ShlinkApiClient'; import type { ShlinkDomainRedirects } from '../../../src/api/types'; +import { editDomainRedirects } from '../../../src/domains/reducers/domainRedirects'; describe('domainRedirectsReducer', () => { describe('editDomainRedirects', () => { diff --git a/test/domains/reducers/domainsList.test.ts b/shlink-web-component/test/domains/reducers/domainsList.test.ts similarity index 91% rename from test/domains/reducers/domainsList.test.ts rename to shlink-web-component/test/domains/reducers/domainsList.test.ts index 11f80568..bb3d4ca1 100644 --- a/test/domains/reducers/domainsList.test.ts +++ b/shlink-web-component/test/domains/reducers/domainsList.test.ts @@ -1,16 +1,16 @@ import { fromPartial } from '@total-typescript/shoehorn'; -import type { Domain } from '../../../shlink-web-component/src/domains/data'; -import type { EditDomainRedirects } from '../../../shlink-web-component/src/domains/reducers/domainRedirects'; -import { editDomainRedirects } from '../../../shlink-web-component/src/domains/reducers/domainRedirects'; +import type { ShlinkApiClient } from '../../../../src/api/services/ShlinkApiClient'; +import type { ShlinkState } from '../../../../src/container/types'; +import type { ShlinkDomainRedirects } from '../../../src/api/types'; +import { parseApiError } from '../../../src/api/utils'; +import type { Domain } from '../../../src/domains/data'; +import type { EditDomainRedirects } from '../../../src/domains/reducers/domainRedirects'; +import { editDomainRedirects } from '../../../src/domains/reducers/domainRedirects'; import { domainsListReducerCreator, replaceRedirectsOnDomain, replaceStatusOnDomain, -} from '../../../shlink-web-component/src/domains/reducers/domainsList'; -import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; -import type { ShlinkDomainRedirects } from '../../../src/api/types'; -import { parseApiError } from '../../../src/api/utils'; -import type { ShlinkState } from '../../../src/container/types'; +} from '../../../src/domains/reducers/domainsList'; describe('domainsListReducer', () => { const dispatch = vi.fn(); diff --git a/test/mercure/helpers/index.test.tsx b/shlink-web-component/test/mercure/helpers/index.test.tsx similarity index 91% rename from test/mercure/helpers/index.test.tsx rename to shlink-web-component/test/mercure/helpers/index.test.tsx index 113a8bcd..0d620272 100644 --- a/test/mercure/helpers/index.test.tsx +++ b/shlink-web-component/test/mercure/helpers/index.test.tsx @@ -1,8 +1,8 @@ import { fromPartial } from '@total-typescript/shoehorn'; import { EventSourcePolyfill } from 'event-source-polyfill'; import { identity } from 'ramda'; -import { bindToMercureTopic } from '../../../shlink-web-component/src/mercure/helpers'; -import type { MercureInfo } from '../../../shlink-web-component/src/mercure/reducers/mercureInfo'; +import { bindToMercureTopic } from '../../../src/mercure/helpers'; +import type { MercureInfo } from '../../../src/mercure/reducers/mercureInfo'; vi.mock('event-source-polyfill'); diff --git a/test/mercure/reducers/mercureInfo.test.ts b/shlink-web-component/test/mercure/reducers/mercureInfo.test.ts similarity index 89% rename from test/mercure/reducers/mercureInfo.test.ts rename to shlink-web-component/test/mercure/reducers/mercureInfo.test.ts index bff9b048..092d78b0 100644 --- a/test/mercure/reducers/mercureInfo.test.ts +++ b/shlink-web-component/test/mercure/reducers/mercureInfo.test.ts @@ -1,7 +1,7 @@ import { fromPartial } from '@total-typescript/shoehorn'; -import { mercureInfoReducerCreator } from '../../../shlink-web-component/src/mercure/reducers/mercureInfo'; -import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; -import type { GetState } from '../../../src/container/types'; +import type { ShlinkApiClient } from '../../../../src/api/services/ShlinkApiClient'; +import type { GetState } from '../../../../src/container/types'; +import { mercureInfoReducerCreator } from '../../../src/mercure/reducers/mercureInfo'; describe('mercureInfoReducer', () => { const mercureInfo = { diff --git a/test/servers/Overview.test.tsx b/shlink-web-component/test/overview/Overview.test.tsx similarity index 93% rename from test/servers/Overview.test.tsx rename to shlink-web-component/test/overview/Overview.test.tsx index 7241d124..ec6c2fb6 100644 --- a/test/servers/Overview.test.tsx +++ b/shlink-web-component/test/overview/Overview.test.tsx @@ -1,9 +1,9 @@ import { screen, waitFor } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { MemoryRouter } from 'react-router-dom'; -import type { MercureInfo } from '../../shlink-web-component/src/mercure/reducers/mercureInfo'; -import { Overview as overviewCreator } from '../../shlink-web-component/src/overview/Overview'; -import { prettify } from '../../shlink-web-component/src/utils/helpers/numbers'; +import type { MercureInfo } from '../../src/mercure/reducers/mercureInfo'; +import { Overview as overviewCreator } from '../../src/overview/Overview'; +import { prettify } from '../../src/utils/helpers/numbers'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/servers/helpers/HighlightCard.test.tsx b/shlink-web-component/test/overview/helpers/HighlightCard.test.tsx similarity index 89% rename from test/servers/helpers/HighlightCard.test.tsx rename to shlink-web-component/test/overview/helpers/HighlightCard.test.tsx index ae5d5045..501d81ab 100644 --- a/test/servers/helpers/HighlightCard.test.tsx +++ b/shlink-web-component/test/overview/helpers/HighlightCard.test.tsx @@ -1,8 +1,8 @@ import { screen, waitFor } from '@testing-library/react'; import type { ReactNode } from 'react'; import { MemoryRouter } from 'react-router-dom'; -import type { HighlightCardProps } from '../../../shlink-web-component/src/overview/helpers/HighlightCard'; -import { HighlightCard } from '../../../shlink-web-component/src/overview/helpers/HighlightCard'; +import type { HighlightCardProps } from '../../../src/overview/helpers/HighlightCard'; +import { HighlightCard } from '../../../src/overview/helpers/HighlightCard'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/servers/helpers/VisitsHighlightCard.test.tsx b/shlink-web-component/test/overview/helpers/VisitsHighlightCard.test.tsx similarity index 84% rename from test/servers/helpers/VisitsHighlightCard.test.tsx rename to shlink-web-component/test/overview/helpers/VisitsHighlightCard.test.tsx index 96947d52..00b385b5 100644 --- a/test/servers/helpers/VisitsHighlightCard.test.tsx +++ b/shlink-web-component/test/overview/helpers/VisitsHighlightCard.test.tsx @@ -1,11 +1,18 @@ import { screen, waitFor } from '@testing-library/react'; -import type { VisitsHighlightCardProps } from '../../../shlink-web-component/src/overview/helpers/VisitsHighlightCard'; -import { VisitsHighlightCard } from '../../../shlink-web-component/src/overview/helpers/VisitsHighlightCard'; +import type { VisitsHighlightCardProps } from '../../../src/overview/helpers/VisitsHighlightCard'; +import { VisitsHighlightCard } from '../../../src/overview/helpers/VisitsHighlightCard'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { const setUp = (props: Partial = {}) => renderWithEvents( - , + , ); it.each([ diff --git a/test/short-urls/CreateShortUrl.test.tsx b/shlink-web-component/test/short-urls/CreateShortUrl.test.tsx similarity index 87% rename from test/short-urls/CreateShortUrl.test.tsx rename to shlink-web-component/test/short-urls/CreateShortUrl.test.tsx index 178b12d6..8027f3b3 100644 --- a/test/short-urls/CreateShortUrl.test.tsx +++ b/shlink-web-component/test/short-urls/CreateShortUrl.test.tsx @@ -1,7 +1,7 @@ import { render, screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; -import { CreateShortUrl as createShortUrlsCreator } from '../../shlink-web-component/src/short-urls/CreateShortUrl'; -import type { ShortUrlCreation } from '../../shlink-web-component/src/short-urls/reducers/shortUrlCreation'; +import { CreateShortUrl as createShortUrlsCreator } from '../../src/short-urls/CreateShortUrl'; +import type { ShortUrlCreation } from '../../src/short-urls/reducers/shortUrlCreation'; describe('', () => { const ShortUrlForm = () => ShortUrlForm; diff --git a/test/short-urls/EditShortUrl.test.tsx b/shlink-web-component/test/short-urls/EditShortUrl.test.tsx similarity index 87% rename from test/short-urls/EditShortUrl.test.tsx rename to shlink-web-component/test/short-urls/EditShortUrl.test.tsx index ffda9d90..560f110e 100644 --- a/test/short-urls/EditShortUrl.test.tsx +++ b/shlink-web-component/test/short-urls/EditShortUrl.test.tsx @@ -1,9 +1,9 @@ import { render, screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { MemoryRouter } from 'react-router-dom'; -import { EditShortUrl as createEditShortUrl } from '../../shlink-web-component/src/short-urls/EditShortUrl'; -import type { ShortUrlDetail } from '../../shlink-web-component/src/short-urls/reducers/shortUrlDetail'; -import type { ShortUrlEdition } from '../../shlink-web-component/src/short-urls/reducers/shortUrlEdition'; +import { EditShortUrl as createEditShortUrl } from '../../src/short-urls/EditShortUrl'; +import type { ShortUrlDetail } from '../../src/short-urls/reducers/shortUrlDetail'; +import type { ShortUrlEdition } from '../../src/short-urls/reducers/shortUrlEdition'; describe('', () => { const shortUrlCreation = { validateUrls: true }; diff --git a/test/short-urls/Paginator.test.tsx b/shlink-web-component/test/short-urls/Paginator.test.tsx similarity index 92% rename from test/short-urls/Paginator.test.tsx rename to shlink-web-component/test/short-urls/Paginator.test.tsx index a392752d..cde9462c 100644 --- a/test/short-urls/Paginator.test.tsx +++ b/shlink-web-component/test/short-urls/Paginator.test.tsx @@ -1,9 +1,9 @@ import { render, screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { MemoryRouter } from 'react-router-dom'; -import { Paginator } from '../../shlink-web-component/src/short-urls/Paginator'; -import { ELLIPSIS } from '../../shlink-web-component/src/utils/helpers/pagination'; import type { ShlinkPaginator } from '../../src/api/types'; +import { Paginator } from '../../src/short-urls/Paginator'; +import { ELLIPSIS } from '../../src/utils/helpers/pagination'; describe('', () => { const buildPaginator = (pagesCount?: number) => fromPartial({ pagesCount, currentPage: 1 }); diff --git a/test/short-urls/ShortUrlForm.test.tsx b/shlink-web-component/test/short-urls/ShortUrlForm.test.tsx similarity index 92% rename from test/short-urls/ShortUrlForm.test.tsx rename to shlink-web-component/test/short-urls/ShortUrlForm.test.tsx index 92a858bc..82dbb72c 100644 --- a/test/short-urls/ShortUrlForm.test.tsx +++ b/shlink-web-component/test/short-urls/ShortUrlForm.test.tsx @@ -2,11 +2,11 @@ import { screen } from '@testing-library/react'; import type { UserEvent } from '@testing-library/user-event/setup/setup'; import { fromPartial } from '@total-typescript/shoehorn'; import { formatISO } from 'date-fns'; -import type { Mode } from '../../shlink-web-component/src/short-urls/ShortUrlForm'; -import { ShortUrlForm as createShortUrlForm } from '../../shlink-web-component/src/short-urls/ShortUrlForm'; -import { parseDate } from '../../shlink-web-component/src/utils/dates/helpers/date'; -import type { ReachableServer, SelectedServer } from '../../src/servers/data'; -import type { OptionalString } from '../../src/utils/utils'; +import type { ReachableServer, SelectedServer } from '../../../src/servers/data'; +import type { OptionalString } from '../../../src/utils/utils'; +import type { Mode } from '../../src/short-urls/ShortUrlForm'; +import { ShortUrlForm as createShortUrlForm } from '../../src/short-urls/ShortUrlForm'; +import { parseDate } from '../../src/utils/dates/helpers/date'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/short-urls/ShortUrlsFilteringBar.test.tsx b/shlink-web-component/test/short-urls/ShortUrlsFilteringBar.test.tsx similarity index 93% rename from test/short-urls/ShortUrlsFilteringBar.test.tsx rename to shlink-web-component/test/short-urls/ShortUrlsFilteringBar.test.tsx index 82a0b7e3..d4137682 100644 --- a/test/short-urls/ShortUrlsFilteringBar.test.tsx +++ b/shlink-web-component/test/short-urls/ShortUrlsFilteringBar.test.tsx @@ -2,10 +2,10 @@ import { screen, waitFor } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { endOfDay, formatISO, startOfDay } from 'date-fns'; import { MemoryRouter, useLocation, useNavigate } from 'react-router-dom'; -import { ShortUrlsFilteringBar as filteringBarCreator } from '../../shlink-web-component/src/short-urls/ShortUrlsFilteringBar'; -import { formatDate } from '../../shlink-web-component/src/utils/dates/helpers/date'; -import type { DateRange } from '../../shlink-web-component/src/utils/dates/helpers/dateIntervals'; -import type { ReachableServer, SelectedServer } from '../../src/servers/data'; +import type { ReachableServer, SelectedServer } from '../../../src/servers/data'; +import { ShortUrlsFilteringBar as filteringBarCreator } from '../../src/short-urls/ShortUrlsFilteringBar'; +import { formatIsoDate } from '../../src/utils/dates/helpers/date'; +import type { DateRange } from '../../src/utils/dates/helpers/dateIntervals'; import { renderWithEvents } from '../__helpers__/setUpTest'; vi.mock('react-router-dom', async () => ({ @@ -65,8 +65,8 @@ describe('', () => { expect(await screen.findByRole('menu')).toBeInTheDocument(); expect(navigate).not.toHaveBeenCalled(); - dates.startDate && await user.type(screen.getByPlaceholderText('Since...'), formatDate()(dates.startDate) ?? ''); - dates.endDate && await user.type(screen.getByPlaceholderText('Until...'), formatDate()(dates.endDate) ?? ''); + dates.startDate && await user.type(screen.getByPlaceholderText('Since...'), formatIsoDate(dates.startDate) ?? ''); + dates.endDate && await user.type(screen.getByPlaceholderText('Until...'), formatIsoDate(dates.endDate) ?? ''); expect(navigate).toHaveBeenLastCalledWith(`/server/1/list-short-urls/1?${expectedQuery}`); }); diff --git a/test/short-urls/ShortUrlsList.test.tsx b/shlink-web-component/test/short-urls/ShortUrlsList.test.tsx similarity index 87% rename from test/short-urls/ShortUrlsList.test.tsx rename to shlink-web-component/test/short-urls/ShortUrlsList.test.tsx index be47ca97..7ef098ca 100644 --- a/test/short-urls/ShortUrlsList.test.tsx +++ b/shlink-web-component/test/short-urls/ShortUrlsList.test.tsx @@ -1,13 +1,13 @@ import { screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { MemoryRouter, useNavigate } from 'react-router-dom'; -import type { MercureBoundProps } from '../../shlink-web-component/src/mercure/helpers/boundToMercureHub'; -import type { ShortUrlsOrder } from '../../shlink-web-component/src/short-urls/data'; -import type { ShortUrlsList as ShortUrlsListModel } from '../../shlink-web-component/src/short-urls/reducers/shortUrlsList'; -import { ShortUrlsList as createShortUrlsList } from '../../shlink-web-component/src/short-urls/ShortUrlsList'; -import type { ShortUrlsTableType } from '../../shlink-web-component/src/short-urls/ShortUrlsTable'; -import type { Settings } from '../../src/settings/reducers/settings'; -import type { SemVer } from '../../src/utils/helpers/version'; +import type { SemVer } from '../../../src/utils/helpers/version'; +import type { Settings } from '../../src'; +import type { MercureBoundProps } from '../../src/mercure/helpers/boundToMercureHub'; +import type { ShortUrlsOrder } from '../../src/short-urls/data'; +import type { ShortUrlsList as ShortUrlsListModel } from '../../src/short-urls/reducers/shortUrlsList'; +import { ShortUrlsList as createShortUrlsList } from '../../src/short-urls/ShortUrlsList'; +import type { ShortUrlsTableType } from '../../src/short-urls/ShortUrlsTable'; import { renderWithEvents } from '../__helpers__/setUpTest'; vi.mock('react-router-dom', async () => ({ diff --git a/test/short-urls/ShortUrlsTable.test.tsx b/shlink-web-component/test/short-urls/ShortUrlsTable.test.tsx similarity index 84% rename from test/short-urls/ShortUrlsTable.test.tsx rename to shlink-web-component/test/short-urls/ShortUrlsTable.test.tsx index 4f2426e2..9676a643 100644 --- a/test/short-urls/ShortUrlsTable.test.tsx +++ b/shlink-web-component/test/short-urls/ShortUrlsTable.test.tsx @@ -1,10 +1,10 @@ import { fireEvent, screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; -import type { ShortUrlsOrderableFields } from '../../shlink-web-component/src/short-urls/data'; -import { SHORT_URLS_ORDERABLE_FIELDS } from '../../shlink-web-component/src/short-urls/data'; -import type { ShortUrlsList } from '../../shlink-web-component/src/short-urls/reducers/shortUrlsList'; -import { ShortUrlsTable as shortUrlsTableCreator } from '../../shlink-web-component/src/short-urls/ShortUrlsTable'; -import type { SelectedServer } from '../../src/servers/data'; +import type { SelectedServer } from '../../../src/servers/data'; +import type { ShortUrlsOrderableFields } from '../../src/short-urls/data'; +import { SHORT_URLS_ORDERABLE_FIELDS } from '../../src/short-urls/data'; +import type { ShortUrlsList } from '../../src/short-urls/reducers/shortUrlsList'; +import { ShortUrlsTable as shortUrlsTableCreator } from '../../src/short-urls/ShortUrlsTable'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/short-urls/UseExistingIfFoundInfoIcon.test.tsx b/shlink-web-component/test/short-urls/UseExistingIfFoundInfoIcon.test.tsx similarity index 82% rename from test/short-urls/UseExistingIfFoundInfoIcon.test.tsx rename to shlink-web-component/test/short-urls/UseExistingIfFoundInfoIcon.test.tsx index 2651d18c..43d2319a 100644 --- a/test/short-urls/UseExistingIfFoundInfoIcon.test.tsx +++ b/shlink-web-component/test/short-urls/UseExistingIfFoundInfoIcon.test.tsx @@ -1,5 +1,5 @@ import { screen } from '@testing-library/react'; -import { UseExistingIfFoundInfoIcon } from '../../shlink-web-component/src/short-urls/UseExistingIfFoundInfoIcon'; +import { UseExistingIfFoundInfoIcon } from '../../src/short-urls/UseExistingIfFoundInfoIcon'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/short-urls/helpers/CreateShortUrlResult.test.tsx b/shlink-web-component/test/short-urls/helpers/CreateShortUrlResult.test.tsx similarity index 87% rename from test/short-urls/helpers/CreateShortUrlResult.test.tsx rename to shlink-web-component/test/short-urls/helpers/CreateShortUrlResult.test.tsx index d4b17615..6b59bf5f 100644 --- a/test/short-urls/helpers/CreateShortUrlResult.test.tsx +++ b/shlink-web-component/test/short-urls/helpers/CreateShortUrlResult.test.tsx @@ -1,8 +1,8 @@ import { screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; -import { CreateShortUrlResult as createResult } from '../../../shlink-web-component/src/short-urls/helpers/CreateShortUrlResult'; -import type { ShortUrlCreation } from '../../../shlink-web-component/src/short-urls/reducers/shortUrlCreation'; -import type { TimeoutToggle } from '../../../src/utils/helpers/hooks'; +import type { TimeoutToggle } from '../../../../src/utils/helpers/hooks'; +import { CreateShortUrlResult as createResult } from '../../../src/short-urls/helpers/CreateShortUrlResult'; +import type { ShortUrlCreation } from '../../../src/short-urls/reducers/shortUrlCreation'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/short-urls/helpers/DeleteShortUrlModal.test.tsx b/shlink-web-component/test/short-urls/helpers/DeleteShortUrlModal.test.tsx similarity index 86% rename from test/short-urls/helpers/DeleteShortUrlModal.test.tsx rename to shlink-web-component/test/short-urls/helpers/DeleteShortUrlModal.test.tsx index fd698a10..336254c9 100644 --- a/test/short-urls/helpers/DeleteShortUrlModal.test.tsx +++ b/shlink-web-component/test/short-urls/helpers/DeleteShortUrlModal.test.tsx @@ -1,10 +1,10 @@ import { screen, waitFor } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; -import type { ShortUrl } from '../../../shlink-web-component/src/short-urls/data'; -import { DeleteShortUrlModal } from '../../../shlink-web-component/src/short-urls/helpers/DeleteShortUrlModal'; -import type { ShortUrlDeletion } from '../../../shlink-web-component/src/short-urls/reducers/shortUrlDeletion'; -import type { InvalidShortUrlDeletion } from '../../../src/api/types/errors'; -import { ErrorTypeV2, ErrorTypeV3 } from '../../../src/api/types/errors'; +import type { InvalidShortUrlDeletion } from '../../../src/api-contract'; +import { ErrorTypeV2, ErrorTypeV3 } from '../../../src/api-contract'; +import type { ShortUrl } from '../../../src/short-urls/data'; +import { DeleteShortUrlModal } from '../../../src/short-urls/helpers/DeleteShortUrlModal'; +import type { ShortUrlDeletion } from '../../../src/short-urls/reducers/shortUrlDeletion'; import { renderWithEvents } from '../../__helpers__/setUpTest'; import { TestModalWrapper } from '../../__helpers__/TestModalWrapper'; diff --git a/test/short-urls/helpers/ExportShortUrlsBtn.test.tsx b/shlink-web-component/test/short-urls/helpers/ExportShortUrlsBtn.test.tsx similarity index 87% rename from test/short-urls/helpers/ExportShortUrlsBtn.test.tsx rename to shlink-web-component/test/short-urls/helpers/ExportShortUrlsBtn.test.tsx index 262289b2..9c9e692b 100644 --- a/test/short-urls/helpers/ExportShortUrlsBtn.test.tsx +++ b/shlink-web-component/test/short-urls/helpers/ExportShortUrlsBtn.test.tsx @@ -1,10 +1,10 @@ import { screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { MemoryRouter } from 'react-router-dom'; -import type { ShortUrl } from '../../../shlink-web-component/src/short-urls/data'; -import { ExportShortUrlsBtn as createExportShortUrlsBtn } from '../../../shlink-web-component/src/short-urls/helpers/ExportShortUrlsBtn'; -import type { ReportExporter } from '../../../shlink-web-component/src/utils/services/ReportExporter'; -import type { NotFoundServer, SelectedServer } from '../../../src/servers/data'; +import type { NotFoundServer, SelectedServer } from '../../../../src/servers/data'; +import type { ShortUrl } from '../../../src/short-urls/data'; +import { ExportShortUrlsBtn as createExportShortUrlsBtn } from '../../../src/short-urls/helpers/ExportShortUrlsBtn'; +import type { ReportExporter } from '../../../src/utils/services/ReportExporter'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/short-urls/helpers/QrCodeModal.test.tsx b/shlink-web-component/test/short-urls/helpers/QrCodeModal.test.tsx similarity index 94% rename from test/short-urls/helpers/QrCodeModal.test.tsx rename to shlink-web-component/test/short-urls/helpers/QrCodeModal.test.tsx index a473ec86..bda32c22 100644 --- a/test/short-urls/helpers/QrCodeModal.test.tsx +++ b/shlink-web-component/test/short-urls/helpers/QrCodeModal.test.tsx @@ -1,7 +1,7 @@ import { fireEvent, screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; -import { QrCodeModal as createQrCodeModal } from '../../../shlink-web-component/src/short-urls/helpers/QrCodeModal'; -import type { SemVer } from '../../../src/utils/helpers/version'; +import type { SemVer } from '../../../../src/utils/helpers/version'; +import { QrCodeModal as createQrCodeModal } from '../../../src/short-urls/helpers/QrCodeModal'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/short-urls/helpers/ShortUrlDetailLink.test.tsx b/shlink-web-component/test/short-urls/helpers/ShortUrlDetailLink.test.tsx similarity index 85% rename from test/short-urls/helpers/ShortUrlDetailLink.test.tsx rename to shlink-web-component/test/short-urls/helpers/ShortUrlDetailLink.test.tsx index 673aa0c5..5b2a37c7 100644 --- a/test/short-urls/helpers/ShortUrlDetailLink.test.tsx +++ b/shlink-web-component/test/short-urls/helpers/ShortUrlDetailLink.test.tsx @@ -1,10 +1,10 @@ import { render, screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { MemoryRouter } from 'react-router-dom'; -import type { ShortUrl } from '../../../shlink-web-component/src/short-urls/data'; -import type { LinkSuffix } from '../../../shlink-web-component/src/short-urls/helpers/ShortUrlDetailLink'; -import { ShortUrlDetailLink } from '../../../shlink-web-component/src/short-urls/helpers/ShortUrlDetailLink'; -import type { NotFoundServer, ReachableServer } from '../../../src/servers/data'; +import type { NotFoundServer, ReachableServer } from '../../../../src/servers/data'; +import type { ShortUrl } from '../../../src/short-urls/data'; +import type { LinkSuffix } from '../../../src/short-urls/helpers/ShortUrlDetailLink'; +import { ShortUrlDetailLink } from '../../../src/short-urls/helpers/ShortUrlDetailLink'; describe('', () => { it.each([ diff --git a/test/short-urls/helpers/ShortUrlFormCheckboxGroup.test.tsx b/shlink-web-component/test/short-urls/helpers/ShortUrlFormCheckboxGroup.test.tsx similarity index 83% rename from test/short-urls/helpers/ShortUrlFormCheckboxGroup.test.tsx rename to shlink-web-component/test/short-urls/helpers/ShortUrlFormCheckboxGroup.test.tsx index fcd7fc77..ec3276d0 100644 --- a/test/short-urls/helpers/ShortUrlFormCheckboxGroup.test.tsx +++ b/shlink-web-component/test/short-urls/helpers/ShortUrlFormCheckboxGroup.test.tsx @@ -1,5 +1,5 @@ import { render, screen } from '@testing-library/react'; -import { ShortUrlFormCheckboxGroup } from '../../../shlink-web-component/src/short-urls/helpers/ShortUrlFormCheckboxGroup'; +import { ShortUrlFormCheckboxGroup } from '../../../src/short-urls/helpers/ShortUrlFormCheckboxGroup'; describe('', () => { it.each([ diff --git a/test/short-urls/helpers/ShortUrlStatus.test.tsx b/shlink-web-component/test/short-urls/helpers/ShortUrlStatus.test.tsx similarity index 90% rename from test/short-urls/helpers/ShortUrlStatus.test.tsx rename to shlink-web-component/test/short-urls/helpers/ShortUrlStatus.test.tsx index 15fbfef2..7755bfc8 100644 --- a/test/short-urls/helpers/ShortUrlStatus.test.tsx +++ b/shlink-web-component/test/short-urls/helpers/ShortUrlStatus.test.tsx @@ -1,9 +1,9 @@ import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { fromPartial } from '@total-typescript/shoehorn'; -import type { ShortUrl, ShortUrlMeta } from '../../../shlink-web-component/src/short-urls/data'; -import { ShortUrlStatus } from '../../../shlink-web-component/src/short-urls/helpers/ShortUrlStatus'; import type { ShlinkVisitsSummary } from '../../../src/api/types'; +import type { ShortUrl, ShortUrlMeta } from '../../../src/short-urls/data'; +import { ShortUrlStatus } from '../../../src/short-urls/helpers/ShortUrlStatus'; describe('', () => { const setUp = (shortUrl: ShortUrl) => ({ diff --git a/test/short-urls/helpers/ShortUrlVisitsCount.test.tsx b/shlink-web-component/test/short-urls/helpers/ShortUrlVisitsCount.test.tsx similarity index 92% rename from test/short-urls/helpers/ShortUrlVisitsCount.test.tsx rename to shlink-web-component/test/short-urls/helpers/ShortUrlVisitsCount.test.tsx index 9dd5fd1b..b810fa6e 100644 --- a/test/short-urls/helpers/ShortUrlVisitsCount.test.tsx +++ b/shlink-web-component/test/short-urls/helpers/ShortUrlVisitsCount.test.tsx @@ -1,8 +1,8 @@ import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { fromPartial } from '@total-typescript/shoehorn'; -import type { ShortUrl } from '../../../shlink-web-component/src/short-urls/data'; -import { ShortUrlVisitsCount } from '../../../shlink-web-component/src/short-urls/helpers/ShortUrlVisitsCount'; +import type { ShortUrl } from '../../../src/short-urls/data'; +import { ShortUrlVisitsCount } from '../../../src/short-urls/helpers/ShortUrlVisitsCount'; describe('', () => { const setUp = (visitsCount: number, shortUrl: ShortUrl) => ({ diff --git a/test/short-urls/helpers/ShortUrlsFilterDropdown.test.tsx b/shlink-web-component/test/short-urls/helpers/ShortUrlsFilterDropdown.test.tsx similarity index 86% rename from test/short-urls/helpers/ShortUrlsFilterDropdown.test.tsx rename to shlink-web-component/test/short-urls/helpers/ShortUrlsFilterDropdown.test.tsx index fbf3eb60..5861b77a 100644 --- a/test/short-urls/helpers/ShortUrlsFilterDropdown.test.tsx +++ b/shlink-web-component/test/short-urls/helpers/ShortUrlsFilterDropdown.test.tsx @@ -1,5 +1,5 @@ import { screen, waitFor } from '@testing-library/react'; -import { ShortUrlsFilterDropdown } from '../../../shlink-web-component/src/short-urls/helpers/ShortUrlsFilterDropdown'; +import { ShortUrlsFilterDropdown } from '../../../src/short-urls/helpers/ShortUrlsFilterDropdown'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/short-urls/helpers/ShortUrlsRow.test.tsx b/shlink-web-component/test/short-urls/helpers/ShortUrlsRow.test.tsx similarity index 91% rename from test/short-urls/helpers/ShortUrlsRow.test.tsx rename to shlink-web-component/test/short-urls/helpers/ShortUrlsRow.test.tsx index abc7ac6f..6ec8db84 100644 --- a/test/short-urls/helpers/ShortUrlsRow.test.tsx +++ b/shlink-web-component/test/short-urls/helpers/ShortUrlsRow.test.tsx @@ -3,13 +3,13 @@ import { fromPartial } from '@total-typescript/shoehorn'; import { addDays, formatISO, subDays } from 'date-fns'; import { last } from 'ramda'; import { MemoryRouter, useLocation } from 'react-router-dom'; -import type { ShortUrl, ShortUrlMeta } from '../../../shlink-web-component/src/short-urls/data'; -import { ShortUrlsRow as createShortUrlsRow } from '../../../shlink-web-component/src/short-urls/helpers/ShortUrlsRow'; -import { now, parseDate } from '../../../shlink-web-component/src/utils/dates/helpers/date'; -import type { ReachableServer } from '../../../src/servers/data'; -import type { Settings } from '../../../src/settings/reducers/settings'; -import type { TimeoutToggle } from '../../../src/utils/helpers/hooks'; -import type { OptionalString } from '../../../src/utils/utils'; +import type { ReachableServer } from '../../../../src/servers/data'; +import type { TimeoutToggle } from '../../../../src/utils/helpers/hooks'; +import type { OptionalString } from '../../../../src/utils/utils'; +import type { Settings } from '../../../src'; +import type { ShortUrl, ShortUrlMeta } from '../../../src/short-urls/data'; +import { ShortUrlsRow as createShortUrlsRow } from '../../../src/short-urls/helpers/ShortUrlsRow'; +import { now, parseDate } from '../../../src/utils/dates/helpers/date'; import { renderWithEvents } from '../../__helpers__/setUpTest'; import { colorGeneratorMock } from '../../utils/services/__mocks__/ColorGenerator.mock'; diff --git a/test/short-urls/helpers/ShortUrlsRowMenu.test.tsx b/shlink-web-component/test/short-urls/helpers/ShortUrlsRowMenu.test.tsx similarity index 84% rename from test/short-urls/helpers/ShortUrlsRowMenu.test.tsx rename to shlink-web-component/test/short-urls/helpers/ShortUrlsRowMenu.test.tsx index 63fccb29..c11dc46c 100644 --- a/test/short-urls/helpers/ShortUrlsRowMenu.test.tsx +++ b/shlink-web-component/test/short-urls/helpers/ShortUrlsRowMenu.test.tsx @@ -1,9 +1,9 @@ import { screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { MemoryRouter } from 'react-router-dom'; -import type { ShortUrl } from '../../../shlink-web-component/src/short-urls/data'; -import { ShortUrlsRowMenu as createShortUrlsRowMenu } from '../../../shlink-web-component/src/short-urls/helpers/ShortUrlsRowMenu'; -import type { ReachableServer } from '../../../src/servers/data'; +import type { ReachableServer } from '../../../../src/servers/data'; +import type { ShortUrl } from '../../../src/short-urls/data'; +import { ShortUrlsRowMenu as createShortUrlsRowMenu } from '../../../src/short-urls/helpers/ShortUrlsRowMenu'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/short-urls/helpers/Tags.test.tsx b/shlink-web-component/test/short-urls/helpers/Tags.test.tsx similarity index 90% rename from test/short-urls/helpers/Tags.test.tsx rename to shlink-web-component/test/short-urls/helpers/Tags.test.tsx index 922c01ee..f2edd302 100644 --- a/test/short-urls/helpers/Tags.test.tsx +++ b/shlink-web-component/test/short-urls/helpers/Tags.test.tsx @@ -1,5 +1,5 @@ import { render, screen } from '@testing-library/react'; -import { Tags } from '../../../shlink-web-component/src/short-urls/helpers/Tags'; +import { Tags } from '../../../src/short-urls/helpers/Tags'; import { colorGeneratorMock } from '../../utils/services/__mocks__/ColorGenerator.mock'; describe('', () => { diff --git a/test/short-urls/helpers/__snapshots__/ShortUrlsRow.test.tsx.snap b/shlink-web-component/test/short-urls/helpers/__snapshots__/ShortUrlsRow.test.tsx.snap similarity index 100% rename from test/short-urls/helpers/__snapshots__/ShortUrlsRow.test.tsx.snap rename to shlink-web-component/test/short-urls/helpers/__snapshots__/ShortUrlsRow.test.tsx.snap diff --git a/test/short-urls/helpers/index.test.ts b/shlink-web-component/test/short-urls/helpers/index.test.ts similarity index 90% rename from test/short-urls/helpers/index.test.ts rename to shlink-web-component/test/short-urls/helpers/index.test.ts index 3c7a34d0..6f252950 100644 --- a/test/short-urls/helpers/index.test.ts +++ b/shlink-web-component/test/short-urls/helpers/index.test.ts @@ -1,6 +1,6 @@ import { fromPartial } from '@total-typescript/shoehorn'; -import type { ShortUrl } from '../../../shlink-web-component/src/short-urls/data'; -import { shortUrlDataFromShortUrl, urlDecodeShortCode, urlEncodeShortCode } from '../../../shlink-web-component/src/short-urls/helpers'; +import type { ShortUrl } from '../../../src/short-urls/data'; +import { shortUrlDataFromShortUrl, urlDecodeShortCode, urlEncodeShortCode } from '../../../src/short-urls/helpers'; describe('helpers', () => { describe('shortUrlDataFromShortUrl', () => { diff --git a/test/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown.test.tsx b/shlink-web-component/test/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown.test.tsx similarity index 86% rename from test/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown.test.tsx rename to shlink-web-component/test/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown.test.tsx index e95cfa3d..5c5f3927 100644 --- a/test/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown.test.tsx +++ b/shlink-web-component/test/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown.test.tsx @@ -1,6 +1,6 @@ import { screen } from '@testing-library/react'; -import { QrErrorCorrectionDropdown } from '../../../../shlink-web-component/src/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown'; -import type { QrErrorCorrection } from '../../../../shlink-web-component/src/utils/helpers/qrCodes'; +import { QrErrorCorrectionDropdown } from '../../../../src/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown'; +import type { QrErrorCorrection } from '../../../../src/utils/helpers/qrCodes'; import { renderWithEvents } from '../../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/short-urls/helpers/qr-codes/QrFormatDropdown.test.tsx b/shlink-web-component/test/short-urls/helpers/qr-codes/QrFormatDropdown.test.tsx similarity index 84% rename from test/short-urls/helpers/qr-codes/QrFormatDropdown.test.tsx rename to shlink-web-component/test/short-urls/helpers/qr-codes/QrFormatDropdown.test.tsx index d90082ee..840f24ea 100644 --- a/test/short-urls/helpers/qr-codes/QrFormatDropdown.test.tsx +++ b/shlink-web-component/test/short-urls/helpers/qr-codes/QrFormatDropdown.test.tsx @@ -1,6 +1,6 @@ import { screen } from '@testing-library/react'; -import { QrFormatDropdown } from '../../../../shlink-web-component/src/short-urls/helpers/qr-codes/QrFormatDropdown'; -import type { QrCodeFormat } from '../../../../shlink-web-component/src/utils/helpers/qrCodes'; +import { QrFormatDropdown } from '../../../../src/short-urls/helpers/qr-codes/QrFormatDropdown'; +import type { QrCodeFormat } from '../../../../src/utils/helpers/qrCodes'; import { renderWithEvents } from '../../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/short-urls/reducers/shortUrlCreation.test.ts b/shlink-web-component/test/short-urls/reducers/shortUrlCreation.test.ts similarity index 86% rename from test/short-urls/reducers/shortUrlCreation.test.ts rename to shlink-web-component/test/short-urls/reducers/shortUrlCreation.test.ts index 7358f8cf..1db2102f 100644 --- a/test/short-urls/reducers/shortUrlCreation.test.ts +++ b/shlink-web-component/test/short-urls/reducers/shortUrlCreation.test.ts @@ -1,11 +1,11 @@ import { fromPartial } from '@total-typescript/shoehorn'; -import type { ShortUrl } from '../../../shlink-web-component/src/short-urls/data'; +import type { ShlinkApiClient } from '../../../../src/api/services/ShlinkApiClient'; +import type { ShlinkState } from '../../../../src/container/types'; +import type { ShortUrl } from '../../../src/short-urls/data'; import { createShortUrl as createShortUrlCreator, shortUrlCreationReducerCreator, -} from '../../../shlink-web-component/src/short-urls/reducers/shortUrlCreation'; -import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; -import type { ShlinkState } from '../../../src/container/types'; +} from '../../../src/short-urls/reducers/shortUrlCreation'; describe('shortUrlCreationReducer', () => { const shortUrl = fromPartial({}); diff --git a/test/short-urls/reducers/shortUrlDeletion.test.ts b/shlink-web-component/test/short-urls/reducers/shortUrlDeletion.test.ts similarity index 94% rename from test/short-urls/reducers/shortUrlDeletion.test.ts rename to shlink-web-component/test/short-urls/reducers/shortUrlDeletion.test.ts index 478892e7..faf12a55 100644 --- a/test/short-urls/reducers/shortUrlDeletion.test.ts +++ b/shlink-web-component/test/short-urls/reducers/shortUrlDeletion.test.ts @@ -1,10 +1,10 @@ import { fromPartial } from '@total-typescript/shoehorn'; +import type { ShlinkApiClient } from '../../../../src/api/services/ShlinkApiClient'; +import type { ProblemDetailsError } from '../../../src/api/types/errors'; import { deleteShortUrl as deleteShortUrlCreator, shortUrlDeletionReducerCreator, -} from '../../../shlink-web-component/src/short-urls/reducers/shortUrlDeletion'; -import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; -import type { ProblemDetailsError } from '../../../src/api/types/errors'; +} from '../../../src/short-urls/reducers/shortUrlDeletion'; describe('shortUrlDeletionReducer', () => { const deleteShortUrlCall = vi.fn(); diff --git a/test/short-urls/reducers/shortUrlDetail.test.ts b/shlink-web-component/test/short-urls/reducers/shortUrlDetail.test.ts similarity index 87% rename from test/short-urls/reducers/shortUrlDetail.test.ts rename to shlink-web-component/test/short-urls/reducers/shortUrlDetail.test.ts index db750565..c4f1caeb 100644 --- a/test/short-urls/reducers/shortUrlDetail.test.ts +++ b/shlink-web-component/test/short-urls/reducers/shortUrlDetail.test.ts @@ -1,9 +1,9 @@ import { fromPartial } from '@total-typescript/shoehorn'; -import type { ShortUrl } from '../../../shlink-web-component/src/short-urls/data'; -import { shortUrlDetailReducerCreator } from '../../../shlink-web-component/src/short-urls/reducers/shortUrlDetail'; -import type { ShortUrlsList } from '../../../shlink-web-component/src/short-urls/reducers/shortUrlsList'; -import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; -import type { ShlinkState } from '../../../src/container/types'; +import type { ShlinkApiClient } from '../../../../src/api/services/ShlinkApiClient'; +import type { ShlinkState } from '../../../../src/container/types'; +import type { ShortUrl } from '../../../src/short-urls/data'; +import { shortUrlDetailReducerCreator } from '../../../src/short-urls/reducers/shortUrlDetail'; +import type { ShortUrlsList } from '../../../src/short-urls/reducers/shortUrlsList'; describe('shortUrlDetailReducer', () => { const getShortUrlCall = vi.fn(); diff --git a/test/short-urls/reducers/shortUrlEdition.test.ts b/shlink-web-component/test/short-urls/reducers/shortUrlEdition.test.ts similarity index 87% rename from test/short-urls/reducers/shortUrlEdition.test.ts rename to shlink-web-component/test/short-urls/reducers/shortUrlEdition.test.ts index ad4b7151..259189ea 100644 --- a/test/short-urls/reducers/shortUrlEdition.test.ts +++ b/shlink-web-component/test/short-urls/reducers/shortUrlEdition.test.ts @@ -1,11 +1,11 @@ import { fromPartial } from '@total-typescript/shoehorn'; -import type { ShortUrl } from '../../../shlink-web-component/src/short-urls/data'; +import type { ShlinkState } from '../../../../src/container/types'; +import type { SelectedServer } from '../../../../src/servers/data'; +import type { ShortUrl } from '../../../src/short-urls/data'; import { editShortUrl as editShortUrlCreator, shortUrlEditionReducerCreator, -} from '../../../shlink-web-component/src/short-urls/reducers/shortUrlEdition'; -import type { ShlinkState } from '../../../src/container/types'; -import type { SelectedServer } from '../../../src/servers/data'; +} from '../../../src/short-urls/reducers/shortUrlEdition'; describe('shortUrlEditionReducer', () => { const longUrl = 'https://shlink.io'; diff --git a/test/short-urls/reducers/shortUrlsList.test.ts b/shlink-web-component/test/short-urls/reducers/shortUrlsList.test.ts similarity index 90% rename from test/short-urls/reducers/shortUrlsList.test.ts rename to shlink-web-component/test/short-urls/reducers/shortUrlsList.test.ts index ecfa637b..6e79ccc0 100644 --- a/test/short-urls/reducers/shortUrlsList.test.ts +++ b/shlink-web-component/test/short-urls/reducers/shortUrlsList.test.ts @@ -1,16 +1,16 @@ import { fromPartial } from '@total-typescript/shoehorn'; -import type { ShortUrl } from '../../../shlink-web-component/src/short-urls/data'; -import { createShortUrl as createShortUrlCreator } from '../../../shlink-web-component/src/short-urls/reducers/shortUrlCreation'; -import { shortUrlDeleted } from '../../../shlink-web-component/src/short-urls/reducers/shortUrlDeletion'; -import { editShortUrl as editShortUrlCreator } from '../../../shlink-web-component/src/short-urls/reducers/shortUrlEdition'; +import type { ShlinkApiClient } from '../../../../src/api/services/ShlinkApiClient'; +import type { ShlinkShortUrlsResponse } from '../../../src/api/types'; +import type { ShortUrl } from '../../../src/short-urls/data'; +import { createShortUrl as createShortUrlCreator } from '../../../src/short-urls/reducers/shortUrlCreation'; +import { shortUrlDeleted } from '../../../src/short-urls/reducers/shortUrlDeletion'; +import { editShortUrl as editShortUrlCreator } from '../../../src/short-urls/reducers/shortUrlEdition'; import { listShortUrls as listShortUrlsCreator, shortUrlsListReducerCreator, -} from '../../../shlink-web-component/src/short-urls/reducers/shortUrlsList'; -import { createNewVisits } from '../../../shlink-web-component/src/visits/reducers/visitCreation'; -import type { CreateVisit } from '../../../shlink-web-component/src/visits/types'; -import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; -import type { ShlinkShortUrlsResponse } from '../../../src/api/types'; +} from '../../../src/short-urls/reducers/shortUrlsList'; +import { createNewVisits } from '../../../src/visits/reducers/visitCreation'; +import type { CreateVisit } from '../../../src/visits/types'; describe('shortUrlsListReducer', () => { const shortCode = 'abc123'; diff --git a/test/tags/TagsList.test.tsx b/shlink-web-component/test/tags/TagsList.test.tsx similarity index 88% rename from test/tags/TagsList.test.tsx rename to shlink-web-component/test/tags/TagsList.test.tsx index 47815ece..d53e52d4 100644 --- a/test/tags/TagsList.test.tsx +++ b/shlink-web-component/test/tags/TagsList.test.tsx @@ -1,10 +1,10 @@ import { screen, waitFor } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { identity } from 'ramda'; -import type { MercureBoundProps } from '../../shlink-web-component/src/mercure/helpers/boundToMercureHub'; -import type { TagsList } from '../../shlink-web-component/src/tags/reducers/tagsList'; -import type { TagsListProps } from '../../shlink-web-component/src/tags/TagsList'; -import { TagsList as createTagsList } from '../../shlink-web-component/src/tags/TagsList'; +import type { MercureBoundProps } from '../../src/mercure/helpers/boundToMercureHub'; +import type { TagsList } from '../../src/tags/reducers/tagsList'; +import type { TagsListProps } from '../../src/tags/TagsList'; +import { TagsList as createTagsList } from '../../src/tags/TagsList'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/tags/TagsTable.test.tsx b/shlink-web-component/test/tags/TagsTable.test.tsx similarity index 95% rename from test/tags/TagsTable.test.tsx rename to shlink-web-component/test/tags/TagsTable.test.tsx index 090edfa3..b7a1350e 100644 --- a/test/tags/TagsTable.test.tsx +++ b/shlink-web-component/test/tags/TagsTable.test.tsx @@ -1,8 +1,8 @@ import { screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { useLocation } from 'react-router-dom'; -import { TagsTable as createTagsTable } from '../../shlink-web-component/src/tags/TagsTable'; -import { rangeOf } from '../../src/utils/utils'; +import { TagsTable as createTagsTable } from '../../src/tags/TagsTable'; +import { rangeOf } from '../../src/utils/helpers'; import { renderWithEvents } from '../__helpers__/setUpTest'; vi.mock('react-router-dom', async () => ({ diff --git a/test/tags/TagsTableRow.test.tsx b/shlink-web-component/test/tags/TagsTableRow.test.tsx similarity index 96% rename from test/tags/TagsTableRow.test.tsx rename to shlink-web-component/test/tags/TagsTableRow.test.tsx index e45ddc56..ec2c4e8a 100644 --- a/test/tags/TagsTableRow.test.tsx +++ b/shlink-web-component/test/tags/TagsTableRow.test.tsx @@ -1,7 +1,7 @@ import { screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { MemoryRouter } from 'react-router-dom'; -import { TagsTableRow as createTagsTableRow } from '../../shlink-web-component/src/tags/TagsTableRow'; +import { TagsTableRow as createTagsTableRow } from '../../src/tags/TagsTableRow'; import { renderWithEvents } from '../__helpers__/setUpTest'; import { colorGeneratorMock } from '../utils/services/__mocks__/ColorGenerator.mock'; diff --git a/test/tags/helpers/DeleteTagConfirmModal.test.tsx b/shlink-web-component/test/tags/helpers/DeleteTagConfirmModal.test.tsx similarity index 91% rename from test/tags/helpers/DeleteTagConfirmModal.test.tsx rename to shlink-web-component/test/tags/helpers/DeleteTagConfirmModal.test.tsx index 55f87936..03dfd732 100644 --- a/test/tags/helpers/DeleteTagConfirmModal.test.tsx +++ b/shlink-web-component/test/tags/helpers/DeleteTagConfirmModal.test.tsx @@ -1,6 +1,6 @@ import { screen } from '@testing-library/react'; -import { DeleteTagConfirmModal } from '../../../shlink-web-component/src/tags/helpers/DeleteTagConfirmModal'; -import type { TagDeletion } from '../../../shlink-web-component/src/tags/reducers/tagDelete'; +import { DeleteTagConfirmModal } from '../../../src/tags/helpers/DeleteTagConfirmModal'; +import type { TagDeletion } from '../../../src/tags/reducers/tagDelete'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/tags/helpers/EditTagModal.test.tsx b/shlink-web-component/test/tags/helpers/EditTagModal.test.tsx similarity index 93% rename from test/tags/helpers/EditTagModal.test.tsx rename to shlink-web-component/test/tags/helpers/EditTagModal.test.tsx index 067760f8..91e57488 100644 --- a/test/tags/helpers/EditTagModal.test.tsx +++ b/shlink-web-component/test/tags/helpers/EditTagModal.test.tsx @@ -1,7 +1,7 @@ import { screen, waitFor } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; -import { EditTagModal as createEditTagModal } from '../../../shlink-web-component/src/tags/helpers/EditTagModal'; -import type { TagEdition } from '../../../shlink-web-component/src/tags/reducers/tagEdit'; +import { EditTagModal as createEditTagModal } from '../../../src/tags/helpers/EditTagModal'; +import type { TagEdition } from '../../../src/tags/reducers/tagEdit'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/tags/helpers/Tag.test.tsx b/shlink-web-component/test/tags/helpers/Tag.test.tsx similarity index 93% rename from test/tags/helpers/Tag.test.tsx rename to shlink-web-component/test/tags/helpers/Tag.test.tsx index 73cdd5ae..8d09286d 100644 --- a/test/tags/helpers/Tag.test.tsx +++ b/shlink-web-component/test/tags/helpers/Tag.test.tsx @@ -1,9 +1,9 @@ import { screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import type { ReactNode } from 'react'; -import { Tag } from '../../../shlink-web-component/src/tags/helpers/Tag'; -import type { ColorGenerator } from '../../../shlink-web-component/src/utils/services/ColorGenerator'; -import { MAIN_COLOR } from '../../../src/utils/theme'; +import { MAIN_COLOR } from '../../../../src/utils/theme'; +import { Tag } from '../../../src/tags/helpers/Tag'; +import type { ColorGenerator } from '../../../src/utils/services/ColorGenerator'; import { renderWithEvents } from '../../__helpers__/setUpTest'; const hexToRgb = (hex: string) => { diff --git a/test/tags/helpers/TagsSelector.test.tsx b/shlink-web-component/test/tags/helpers/TagsSelector.test.tsx similarity index 92% rename from test/tags/helpers/TagsSelector.test.tsx rename to shlink-web-component/test/tags/helpers/TagsSelector.test.tsx index 7916d905..08bb3058 100644 --- a/test/tags/helpers/TagsSelector.test.tsx +++ b/shlink-web-component/test/tags/helpers/TagsSelector.test.tsx @@ -1,7 +1,7 @@ import { screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; -import { TagsSelector as createTagsSelector } from '../../../shlink-web-component/src/tags/helpers/TagsSelector'; -import type { TagsList } from '../../../shlink-web-component/src/tags/reducers/tagsList'; +import { TagsSelector as createTagsSelector } from '../../../src/tags/helpers/TagsSelector'; +import type { TagsList } from '../../../src/tags/reducers/tagsList'; import { renderWithEvents } from '../../__helpers__/setUpTest'; import { colorGeneratorMock } from '../../utils/services/__mocks__/ColorGenerator.mock'; diff --git a/test/tags/reducers/tagDelete.test.ts b/shlink-web-component/test/tags/reducers/tagDelete.test.ts similarity index 87% rename from test/tags/reducers/tagDelete.test.ts rename to shlink-web-component/test/tags/reducers/tagDelete.test.ts index a68d8cad..c0d7a5b2 100644 --- a/test/tags/reducers/tagDelete.test.ts +++ b/shlink-web-component/test/tags/reducers/tagDelete.test.ts @@ -1,7 +1,7 @@ import { fromPartial } from '@total-typescript/shoehorn'; -import { tagDeleted, tagDeleteReducerCreator } from '../../../shlink-web-component/src/tags/reducers/tagDelete'; -import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; -import type { ShlinkState } from '../../../src/container/types'; +import type { ShlinkApiClient } from '../../../../src/api/services/ShlinkApiClient'; +import type { ShlinkState } from '../../../../src/container/types'; +import { tagDeleted, tagDeleteReducerCreator } from '../../../src/tags/reducers/tagDelete'; describe('tagDeleteReducer', () => { const deleteTagsCall = vi.fn(); diff --git a/test/tags/reducers/tagEdit.test.ts b/shlink-web-component/test/tags/reducers/tagEdit.test.ts similarity index 87% rename from test/tags/reducers/tagEdit.test.ts rename to shlink-web-component/test/tags/reducers/tagEdit.test.ts index 1fd9259c..d0056114 100644 --- a/test/tags/reducers/tagEdit.test.ts +++ b/shlink-web-component/test/tags/reducers/tagEdit.test.ts @@ -1,8 +1,8 @@ import { fromPartial } from '@total-typescript/shoehorn'; -import { editTag as editTagCreator, tagEdited, tagEditReducerCreator } from '../../../shlink-web-component/src/tags/reducers/tagEdit'; -import type { ColorGenerator } from '../../../shlink-web-component/src/utils/services/ColorGenerator'; -import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; -import type { ShlinkState } from '../../../src/container/types'; +import type { ShlinkApiClient } from '../../../../src/api/services/ShlinkApiClient'; +import type { ShlinkState } from '../../../../src/container/types'; +import { editTag as editTagCreator, tagEdited, tagEditReducerCreator } from '../../../src/tags/reducers/tagEdit'; +import type { ColorGenerator } from '../../../src/utils/services/ColorGenerator'; describe('tagEditReducer', () => { const oldName = 'foo'; diff --git a/test/tags/reducers/tagsList.test.ts b/shlink-web-component/test/tags/reducers/tagsList.test.ts similarity index 90% rename from test/tags/reducers/tagsList.test.ts rename to shlink-web-component/test/tags/reducers/tagsList.test.ts index 54dbb6a2..276a7366 100644 --- a/test/tags/reducers/tagsList.test.ts +++ b/shlink-web-component/test/tags/reducers/tagsList.test.ts @@ -1,18 +1,18 @@ import { fromPartial } from '@total-typescript/shoehorn'; -import type { ShortUrl } from '../../../shlink-web-component/src/short-urls/data'; -import { createShortUrl as createShortUrlCreator } from '../../../shlink-web-component/src/short-urls/reducers/shortUrlCreation'; -import { tagDeleted } from '../../../shlink-web-component/src/tags/reducers/tagDelete'; -import { tagEdited } from '../../../shlink-web-component/src/tags/reducers/tagEdit'; +import type { ShlinkState } from '../../../../src/container/types'; +import type { ShortUrl } from '../../../src/short-urls/data'; +import { createShortUrl as createShortUrlCreator } from '../../../src/short-urls/reducers/shortUrlCreation'; +import { tagDeleted } from '../../../src/tags/reducers/tagDelete'; +import { tagEdited } from '../../../src/tags/reducers/tagEdit'; import type { - TagsList } from '../../../shlink-web-component/src/tags/reducers/tagsList'; + TagsList } from '../../../src/tags/reducers/tagsList'; import { filterTags, listTags as listTagsCreator, tagsListReducerCreator, -} from '../../../shlink-web-component/src/tags/reducers/tagsList'; -import { createNewVisits } from '../../../shlink-web-component/src/visits/reducers/visitCreation'; -import type { CreateVisit } from '../../../shlink-web-component/src/visits/types'; -import type { ShlinkState } from '../../../src/container/types'; +} from '../../../src/tags/reducers/tagsList'; +import { createNewVisits } from '../../../src/visits/reducers/visitCreation'; +import type { CreateVisit } from '../../../src/visits/types'; describe('tagsListReducer', () => { const state = (props: Partial) => fromPartial(props); diff --git a/test/utils/CopyToClipboardIcon.test.tsx b/shlink-web-component/test/utils/components/CopyToClipboardIcon.test.tsx similarity index 79% rename from test/utils/CopyToClipboardIcon.test.tsx rename to shlink-web-component/test/utils/components/CopyToClipboardIcon.test.tsx index 4c5370ac..01aee93b 100644 --- a/test/utils/CopyToClipboardIcon.test.tsx +++ b/shlink-web-component/test/utils/components/CopyToClipboardIcon.test.tsx @@ -1,5 +1,5 @@ -import { CopyToClipboardIcon } from '../../shlink-web-component/src/utils/components/CopyToClipboardIcon'; -import { renderWithEvents } from '../__helpers__/setUpTest'; +import { CopyToClipboardIcon } from '../../../src/utils/components/CopyToClipboardIcon'; +import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { const onCopy = vi.fn(); diff --git a/test/utils/ExportBtn.test.tsx b/shlink-web-component/test/utils/components/ExportBtn.test.tsx similarity index 92% rename from test/utils/ExportBtn.test.tsx rename to shlink-web-component/test/utils/components/ExportBtn.test.tsx index fbdbcf02..39d0f5cd 100644 --- a/test/utils/ExportBtn.test.tsx +++ b/shlink-web-component/test/utils/components/ExportBtn.test.tsx @@ -1,5 +1,5 @@ import { render, screen } from '@testing-library/react'; -import { ExportBtn } from '../../shlink-web-component/src/utils/components/ExportBtn'; +import { ExportBtn } from '../../../src/utils/components/ExportBtn'; describe('', () => { const setUp = (amount?: number, loading = false) => render(); diff --git a/test/utils/IconInput.test.tsx b/shlink-web-component/test/utils/components/IconInput.test.tsx similarity index 85% rename from test/utils/IconInput.test.tsx rename to shlink-web-component/test/utils/components/IconInput.test.tsx index 9e241b12..96bee16d 100644 --- a/test/utils/IconInput.test.tsx +++ b/shlink-web-component/test/utils/components/IconInput.test.tsx @@ -1,8 +1,8 @@ import type { IconProp } from '@fortawesome/fontawesome-svg-core'; import { faAppleAlt, faCalendar, faTable } from '@fortawesome/free-solid-svg-icons'; import { screen } from '@testing-library/react'; -import { IconInput } from '../../shlink-web-component/src/utils/components/IconInput'; -import { renderWithEvents } from '../__helpers__/setUpTest'; +import { IconInput } from '../../../src/utils/components/IconInput'; +import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { const setUp = (icon: IconProp, placeholder?: string) => renderWithEvents( diff --git a/test/utils/InfoTooltip.test.tsx b/shlink-web-component/test/utils/components/InfoTooltip.test.tsx similarity index 86% rename from test/utils/InfoTooltip.test.tsx rename to shlink-web-component/test/utils/components/InfoTooltip.test.tsx index 40e46ce8..13c97c8e 100644 --- a/test/utils/InfoTooltip.test.tsx +++ b/shlink-web-component/test/utils/components/InfoTooltip.test.tsx @@ -1,8 +1,8 @@ import type { Placement } from '@popperjs/core'; import { screen, waitFor } from '@testing-library/react'; -import type { InfoTooltipProps } from '../../shlink-web-component/src/utils/components/InfoTooltip'; -import { InfoTooltip } from '../../shlink-web-component/src/utils/components/InfoTooltip'; -import { renderWithEvents } from '../__helpers__/setUpTest'; +import type { InfoTooltipProps } from '../../../src/utils/components/InfoTooltip'; +import { InfoTooltip } from '../../../src/utils/components/InfoTooltip'; +import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { const setUp = (props: Partial = {}) => renderWithEvents( diff --git a/test/utils/PaginationDropdown.test.tsx b/shlink-web-component/test/utils/components/PaginationDropdown.test.tsx similarity index 84% rename from test/utils/PaginationDropdown.test.tsx rename to shlink-web-component/test/utils/components/PaginationDropdown.test.tsx index 8ce50a7f..57a8be6b 100644 --- a/test/utils/PaginationDropdown.test.tsx +++ b/shlink-web-component/test/utils/components/PaginationDropdown.test.tsx @@ -1,6 +1,6 @@ import { screen } from '@testing-library/react'; -import { PaginationDropdown } from '../../shlink-web-component/src/utils/components/PaginationDropdown'; -import { renderWithEvents } from '../__helpers__/setUpTest'; +import { PaginationDropdown } from '../../../src/utils/components/PaginationDropdown'; +import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { const setValue = vi.fn(); diff --git a/test/utils/__snapshots__/CopyToClipboardIcon.test.tsx.snap b/shlink-web-component/test/utils/components/__snapshots__/CopyToClipboardIcon.test.tsx.snap similarity index 100% rename from test/utils/__snapshots__/CopyToClipboardIcon.test.tsx.snap rename to shlink-web-component/test/utils/components/__snapshots__/CopyToClipboardIcon.test.tsx.snap diff --git a/test/utils/__snapshots__/ExportBtn.test.tsx.snap b/shlink-web-component/test/utils/components/__snapshots__/ExportBtn.test.tsx.snap similarity index 100% rename from test/utils/__snapshots__/ExportBtn.test.tsx.snap rename to shlink-web-component/test/utils/components/__snapshots__/ExportBtn.test.tsx.snap diff --git a/test/utils/__snapshots__/IconInput.test.tsx.snap b/shlink-web-component/test/utils/components/__snapshots__/IconInput.test.tsx.snap similarity index 100% rename from test/utils/__snapshots__/IconInput.test.tsx.snap rename to shlink-web-component/test/utils/components/__snapshots__/IconInput.test.tsx.snap diff --git a/test/utils/dates/DateInput.test.tsx b/shlink-web-component/test/utils/dates/DateInput.test.tsx similarity index 90% rename from test/utils/dates/DateInput.test.tsx rename to shlink-web-component/test/utils/dates/DateInput.test.tsx index 95d56619..b37e3409 100644 --- a/test/utils/dates/DateInput.test.tsx +++ b/shlink-web-component/test/utils/dates/DateInput.test.tsx @@ -1,8 +1,8 @@ import { screen, waitFor } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { parseISO } from 'date-fns'; -import type { DateInputProps } from '../../../shlink-web-component/src/utils/dates/DateInput'; -import { DateInput } from '../../../shlink-web-component/src/utils/dates/DateInput'; +import type { DateInputProps } from '../../../src/utils/dates/DateInput'; +import { DateInput } from '../../../src/utils/dates/DateInput'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/utils/dates/DateIntervalDropdownItems.test.tsx b/shlink-web-component/test/utils/dates/DateIntervalDropdownItems.test.tsx similarity index 87% rename from test/utils/dates/DateIntervalDropdownItems.test.tsx rename to shlink-web-component/test/utils/dates/DateIntervalDropdownItems.test.tsx index 2e43ed47..dbfd358e 100644 --- a/test/utils/dates/DateIntervalDropdownItems.test.tsx +++ b/shlink-web-component/test/utils/dates/DateIntervalDropdownItems.test.tsx @@ -1,8 +1,8 @@ import { screen, waitFor } from '@testing-library/react'; -import { DropdownBtn } from '../../../shlink-frontend-kit/src/navigation/DropdownBtn'; -import type { DateInterval } from '../../../shlink-web-component/src/utils/dates/helpers/dateIntervals'; -import { DATE_INTERVALS, rangeOrIntervalToString } from '../../../shlink-web-component/src/utils/dates/helpers/dateIntervals'; +import { DropdownBtn } from '../../../../shlink-frontend-kit/src'; import { DateIntervalDropdownItems } from '../../../src/utils/dates/DateIntervalDropdownItems'; +import type { DateInterval } from '../../../src/utils/dates/helpers/dateIntervals'; +import { DATE_INTERVALS, rangeOrIntervalToString } from '../../../src/utils/dates/helpers/dateIntervals'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/utils/dates/DateRangeRow.test.tsx b/shlink-web-component/test/utils/dates/DateRangeRow.test.tsx similarity index 92% rename from test/utils/dates/DateRangeRow.test.tsx rename to shlink-web-component/test/utils/dates/DateRangeRow.test.tsx index 388ebfae..85f05904 100644 --- a/test/utils/dates/DateRangeRow.test.tsx +++ b/shlink-web-component/test/utils/dates/DateRangeRow.test.tsx @@ -1,5 +1,5 @@ import { screen } from '@testing-library/react'; -import { DateRangeRow } from '../../../shlink-web-component/src/utils/dates/DateRangeRow'; +import { DateRangeRow } from '../../../src/utils/dates/DateRangeRow'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/utils/dates/DateRangeSelector.test.tsx b/shlink-web-component/test/utils/dates/DateRangeSelector.test.tsx similarity index 88% rename from test/utils/dates/DateRangeSelector.test.tsx rename to shlink-web-component/test/utils/dates/DateRangeSelector.test.tsx index 54d4b595..016a5496 100644 --- a/test/utils/dates/DateRangeSelector.test.tsx +++ b/shlink-web-component/test/utils/dates/DateRangeSelector.test.tsx @@ -1,8 +1,8 @@ import { screen, waitFor } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; -import type { DateRangeSelectorProps } from '../../../shlink-web-component/src/utils/dates/DateRangeSelector'; -import { DateRangeSelector } from '../../../shlink-web-component/src/utils/dates/DateRangeSelector'; -import type { DateInterval } from '../../../shlink-web-component/src/utils/dates/helpers/dateIntervals'; +import type { DateRangeSelectorProps } from '../../../src/utils/dates/DateRangeSelector'; +import { DateRangeSelector } from '../../../src/utils/dates/DateRangeSelector'; +import type { DateInterval } from '../../../src/utils/dates/helpers/dateIntervals'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/utils/dates/Time.test.tsx b/shlink-web-component/test/utils/dates/Time.test.tsx similarity index 77% rename from test/utils/dates/Time.test.tsx rename to shlink-web-component/test/utils/dates/Time.test.tsx index 367e5d2f..e3f0388f 100644 --- a/test/utils/dates/Time.test.tsx +++ b/shlink-web-component/test/utils/dates/Time.test.tsx @@ -1,7 +1,7 @@ import { render } from '@testing-library/react'; -import { parseDate } from '../../../shlink-web-component/src/utils/dates/helpers/date'; -import type { TimeProps } from '../../../shlink-web-component/src/utils/dates/Time'; -import { Time } from '../../../shlink-web-component/src/utils/dates/Time'; +import { parseDate } from '../../../src/utils/dates/helpers/date'; +import type { TimeProps } from '../../../src/utils/dates/Time'; +import { Time } from '../../../src/utils/dates/Time'; describe('