Move stuff belonging to the component to shlink-web-component

This commit is contained in:
Alejandro Celaya
2023-07-16 08:47:10 +02:00
parent cbbb679dfc
commit d82c0dc75e
204 changed files with 568 additions and 563 deletions

View File

@@ -1,7 +1,7 @@
import { render, screen } from '@testing-library/react';
import { fromPartial } from '@total-typescript/shoehorn';
import { CreateShortUrl as createShortUrlsCreator } from '../../src/short-urls/CreateShortUrl';
import type { ShortUrlCreation } from '../../src/short-urls/reducers/shortUrlCreation';
import { CreateShortUrl as createShortUrlsCreator } from '../../src/shlink-web-component/short-urls/CreateShortUrl';
import type { ShortUrlCreation } from '../../src/shlink-web-component/short-urls/reducers/shortUrlCreation';
describe('<CreateShortUrl />', () => {
const ShortUrlForm = () => <span>ShortUrlForm</span>;

View File

@@ -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 '../../src/short-urls/EditShortUrl';
import type { ShortUrlDetail } from '../../src/short-urls/reducers/shortUrlDetail';
import type { ShortUrlEdition } from '../../src/short-urls/reducers/shortUrlEdition';
import { EditShortUrl as createEditShortUrl } from '../../src/shlink-web-component/short-urls/EditShortUrl';
import type { ShortUrlDetail } from '../../src/shlink-web-component/short-urls/reducers/shortUrlDetail';
import type { ShortUrlEdition } from '../../src/shlink-web-component/short-urls/reducers/shortUrlEdition';
describe('<EditShortUrl />', () => {
const shortUrlCreation = { validateUrls: true };

View File

@@ -2,7 +2,7 @@ import { render, screen } from '@testing-library/react';
import { fromPartial } from '@total-typescript/shoehorn';
import { MemoryRouter } from 'react-router-dom';
import type { ShlinkPaginator } from '../../src/api/types';
import { Paginator } from '../../src/short-urls/Paginator';
import { Paginator } from '../../src/shlink-web-component/short-urls/Paginator';
import { ELLIPSIS } from '../../src/utils/helpers/pagination';
describe('<Paginator />', () => {

View File

@@ -3,8 +3,8 @@ import type { UserEvent } from '@testing-library/user-event/setup/setup';
import { fromPartial } from '@total-typescript/shoehorn';
import { formatISO } from 'date-fns';
import type { ReachableServer, SelectedServer } from '../../src/servers/data';
import type { Mode } from '../../src/short-urls/ShortUrlForm';
import { ShortUrlForm as createShortUrlForm } from '../../src/short-urls/ShortUrlForm';
import type { Mode } from '../../src/shlink-web-component/short-urls/ShortUrlForm';
import { ShortUrlForm as createShortUrlForm } from '../../src/shlink-web-component/short-urls/ShortUrlForm';
import { parseDate } from '../../src/utils/helpers/date';
import type { OptionalString } from '../../src/utils/utils';
import { renderWithEvents } from '../__helpers__/setUpTest';

View File

@@ -3,7 +3,7 @@ import { fromPartial } from '@total-typescript/shoehorn';
import { endOfDay, formatISO, startOfDay } from 'date-fns';
import { MemoryRouter, useLocation, useNavigate } from 'react-router-dom';
import type { ReachableServer, SelectedServer } from '../../src/servers/data';
import { ShortUrlsFilteringBar as filteringBarCreator } from '../../src/short-urls/ShortUrlsFilteringBar';
import { ShortUrlsFilteringBar as filteringBarCreator } from '../../src/shlink-web-component/short-urls/ShortUrlsFilteringBar';
import { formatDate } from '../../src/utils/helpers/date';
import type { DateRange } from '../../src/utils/helpers/dateIntervals';
import { renderWithEvents } from '../__helpers__/setUpTest';

View File

@@ -3,10 +3,10 @@ import { fromPartial } from '@total-typescript/shoehorn';
import { MemoryRouter, useNavigate } from 'react-router-dom';
import type { MercureBoundProps } from '../../src/mercure/helpers/boundToMercureHub';
import type { Settings } from '../../src/settings/reducers/settings';
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 type { ShortUrlsOrder } from '../../src/shlink-web-component/short-urls/data';
import type { ShortUrlsList as ShortUrlsListModel } from '../../src/shlink-web-component/short-urls/reducers/shortUrlsList';
import { ShortUrlsList as createShortUrlsList } from '../../src/shlink-web-component/short-urls/ShortUrlsList';
import type { ShortUrlsTableType } from '../../src/shlink-web-component/short-urls/ShortUrlsTable';
import type { SemVer } from '../../src/utils/helpers/version';
import { renderWithEvents } from '../__helpers__/setUpTest';

View File

@@ -1,10 +1,10 @@
import { fireEvent, screen } from '@testing-library/react';
import { fromPartial } from '@total-typescript/shoehorn';
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 type { ShortUrlsOrderableFields } from '../../src/shlink-web-component/short-urls/data';
import { SHORT_URLS_ORDERABLE_FIELDS } from '../../src/shlink-web-component/short-urls/data';
import type { ShortUrlsList } from '../../src/shlink-web-component/short-urls/reducers/shortUrlsList';
import { ShortUrlsTable as shortUrlsTableCreator } from '../../src/shlink-web-component/short-urls/ShortUrlsTable';
import { renderWithEvents } from '../__helpers__/setUpTest';
describe('<ShortUrlsTable />', () => {

View File

@@ -1,5 +1,5 @@
import { screen } from '@testing-library/react';
import { UseExistingIfFoundInfoIcon } from '../../src/short-urls/UseExistingIfFoundInfoIcon';
import { UseExistingIfFoundInfoIcon } from '../../src/shlink-web-component/short-urls/UseExistingIfFoundInfoIcon';
import { renderWithEvents } from '../__helpers__/setUpTest';
describe('<UseExistingIfFoundInfoIcon />', () => {

View File

@@ -1,7 +1,7 @@
import { screen } from '@testing-library/react';
import { fromPartial } from '@total-typescript/shoehorn';
import { CreateShortUrlResult as createResult } from '../../../src/short-urls/helpers/CreateShortUrlResult';
import type { ShortUrlCreation } from '../../../src/short-urls/reducers/shortUrlCreation';
import { CreateShortUrlResult as createResult } from '../../../src/shlink-web-component/short-urls/helpers/CreateShortUrlResult';
import type { ShortUrlCreation } from '../../../src/shlink-web-component/short-urls/reducers/shortUrlCreation';
import type { TimeoutToggle } from '../../../src/utils/helpers/hooks';
import { renderWithEvents } from '../../__helpers__/setUpTest';

View File

@@ -2,9 +2,9 @@ import { screen, waitFor } from '@testing-library/react';
import { fromPartial } from '@total-typescript/shoehorn';
import type { InvalidShortUrlDeletion } from '../../../src/api/types/errors';
import { ErrorTypeV2, ErrorTypeV3 } from '../../../src/api/types/errors';
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 type { ShortUrl } from '../../../src/shlink-web-component/short-urls/data';
import { DeleteShortUrlModal } from '../../../src/shlink-web-component/short-urls/helpers/DeleteShortUrlModal';
import type { ShortUrlDeletion } from '../../../src/shlink-web-component/short-urls/reducers/shortUrlDeletion';
import { renderWithEvents } from '../../__helpers__/setUpTest';
import { TestModalWrapper } from '../../__helpers__/TestModalWrapper';

View File

@@ -3,8 +3,8 @@ import { fromPartial } from '@total-typescript/shoehorn';
import { MemoryRouter } from 'react-router-dom';
import type { ReportExporter } from '../../../src/common/services/ReportExporter';
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 { ShortUrl } from '../../../src/shlink-web-component/short-urls/data';
import { ExportShortUrlsBtn as createExportShortUrlsBtn } from '../../../src/shlink-web-component/short-urls/helpers/ExportShortUrlsBtn';
import { renderWithEvents } from '../../__helpers__/setUpTest';
describe('<ExportShortUrlsBtn />', () => {

View File

@@ -1,6 +1,6 @@
import { fireEvent, screen } from '@testing-library/react';
import { fromPartial } from '@total-typescript/shoehorn';
import { QrCodeModal as createQrCodeModal } from '../../../src/short-urls/helpers/QrCodeModal';
import { QrCodeModal as createQrCodeModal } from '../../../src/shlink-web-component/short-urls/helpers/QrCodeModal';
import type { SemVer } from '../../../src/utils/helpers/version';
import { renderWithEvents } from '../../__helpers__/setUpTest';

View File

@@ -2,9 +2,9 @@ import { render, screen } from '@testing-library/react';
import { fromPartial } from '@total-typescript/shoehorn';
import { MemoryRouter } from 'react-router-dom';
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';
import type { ShortUrl } from '../../../src/shlink-web-component/short-urls/data';
import type { LinkSuffix } from '../../../src/shlink-web-component/short-urls/helpers/ShortUrlDetailLink';
import { ShortUrlDetailLink } from '../../../src/shlink-web-component/short-urls/helpers/ShortUrlDetailLink';
describe('<ShortUrlDetailLink />', () => {
it.each([

View File

@@ -1,5 +1,5 @@
import { render, screen } from '@testing-library/react';
import { ShortUrlFormCheckboxGroup } from '../../../src/short-urls/helpers/ShortUrlFormCheckboxGroup';
import { ShortUrlFormCheckboxGroup } from '../../../src/shlink-web-component/short-urls/helpers/ShortUrlFormCheckboxGroup';
describe('<ShortUrlFormCheckboxGroup />', () => {
it.each([

View File

@@ -2,8 +2,8 @@ import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { fromPartial } from '@total-typescript/shoehorn';
import type { ShlinkVisitsSummary } from '../../../src/api/types';
import type { ShortUrl, ShortUrlMeta } from '../../../src/short-urls/data';
import { ShortUrlStatus } from '../../../src/short-urls/helpers/ShortUrlStatus';
import type { ShortUrl, ShortUrlMeta } from '../../../src/shlink-web-component/short-urls/data';
import { ShortUrlStatus } from '../../../src/shlink-web-component/short-urls/helpers/ShortUrlStatus';
describe('<ShortUrlStatus />', () => {
const setUp = (shortUrl: ShortUrl) => ({

View File

@@ -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 '../../../src/short-urls/data';
import { ShortUrlVisitsCount } from '../../../src/short-urls/helpers/ShortUrlVisitsCount';
import type { ShortUrl } from '../../../src/shlink-web-component/short-urls/data';
import { ShortUrlVisitsCount } from '../../../src/shlink-web-component/short-urls/helpers/ShortUrlVisitsCount';
describe('<ShortUrlVisitsCount />', () => {
const setUp = (visitsCount: number, shortUrl: ShortUrl) => ({

View File

@@ -1,5 +1,5 @@
import { screen, waitFor } from '@testing-library/react';
import { ShortUrlsFilterDropdown } from '../../../src/short-urls/helpers/ShortUrlsFilterDropdown';
import { ShortUrlsFilterDropdown } from '../../../src/shlink-web-component/short-urls/helpers/ShortUrlsFilterDropdown';
import { renderWithEvents } from '../../__helpers__/setUpTest';
describe('<ShortUrlsFilterDropdown />', () => {

View File

@@ -5,8 +5,8 @@ import { last } from 'ramda';
import { MemoryRouter, useLocation } from 'react-router-dom';
import type { ReachableServer } from '../../../src/servers/data';
import type { Settings } from '../../../src/settings/reducers/settings';
import type { ShortUrl, ShortUrlMeta } from '../../../src/short-urls/data';
import { ShortUrlsRow as createShortUrlsRow } from '../../../src/short-urls/helpers/ShortUrlsRow';
import type { ShortUrl, ShortUrlMeta } from '../../../src/shlink-web-component/short-urls/data';
import { ShortUrlsRow as createShortUrlsRow } from '../../../src/shlink-web-component/short-urls/helpers/ShortUrlsRow';
import { now, parseDate } from '../../../src/utils/helpers/date';
import type { TimeoutToggle } from '../../../src/utils/helpers/hooks';
import type { OptionalString } from '../../../src/utils/utils';

View File

@@ -2,8 +2,8 @@ import { screen } from '@testing-library/react';
import { fromPartial } from '@total-typescript/shoehorn';
import { MemoryRouter } from 'react-router-dom';
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 type { ShortUrl } from '../../../src/shlink-web-component/short-urls/data';
import { ShortUrlsRowMenu as createShortUrlsRowMenu } from '../../../src/shlink-web-component/short-urls/helpers/ShortUrlsRowMenu';
import { renderWithEvents } from '../../__helpers__/setUpTest';
describe('<ShortUrlsRowMenu />', () => {

View File

@@ -1,5 +1,5 @@
import { render, screen } from '@testing-library/react';
import { Tags } from '../../../src/short-urls/helpers/Tags';
import { Tags } from '../../../src/shlink-web-component/short-urls/helpers/Tags';
import { colorGeneratorMock } from '../../utils/services/__mocks__/ColorGenerator.mock';
describe('<Tags />', () => {

View File

@@ -1,6 +1,6 @@
import { fromPartial } from '@total-typescript/shoehorn';
import type { ShortUrl } from '../../../src/short-urls/data';
import { shortUrlDataFromShortUrl, urlDecodeShortCode, urlEncodeShortCode } from '../../../src/short-urls/helpers';
import type { ShortUrl } from '../../../src/shlink-web-component/short-urls/data';
import { shortUrlDataFromShortUrl, urlDecodeShortCode, urlEncodeShortCode } from '../../../src/shlink-web-component/short-urls/helpers';
describe('helpers', () => {
describe('shortUrlDataFromShortUrl', () => {

View File

@@ -1,5 +1,5 @@
import { screen } from '@testing-library/react';
import { QrErrorCorrectionDropdown } from '../../../../src/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown';
import { QrErrorCorrectionDropdown } from '../../../../src/shlink-web-component/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown';
import type { QrErrorCorrection } from '../../../../src/utils/helpers/qrCodes';
import { renderWithEvents } from '../../../__helpers__/setUpTest';

View File

@@ -1,5 +1,5 @@
import { screen } from '@testing-library/react';
import { QrFormatDropdown } from '../../../../src/short-urls/helpers/qr-codes/QrFormatDropdown';
import { QrFormatDropdown } from '../../../../src/shlink-web-component/short-urls/helpers/qr-codes/QrFormatDropdown';
import type { QrCodeFormat } from '../../../../src/utils/helpers/qrCodes';
import { renderWithEvents } from '../../../__helpers__/setUpTest';

View File

@@ -1,11 +1,11 @@
import { fromPartial } from '@total-typescript/shoehorn';
import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient';
import type { ShlinkState } from '../../../src/container/types';
import type { ShortUrl } from '../../../src/short-urls/data';
import type { ShortUrl } from '../../../src/shlink-web-component/short-urls/data';
import {
createShortUrl as createShortUrlCreator,
shortUrlCreationReducerCreator,
} from '../../../src/short-urls/reducers/shortUrlCreation';
} from '../../../src/shlink-web-component/short-urls/reducers/shortUrlCreation';
describe('shortUrlCreationReducer', () => {
const shortUrl = fromPartial<ShortUrl>({});

View File

@@ -4,7 +4,7 @@ import type { ProblemDetailsError } from '../../../src/api/types/errors';
import {
deleteShortUrl as deleteShortUrlCreator,
shortUrlDeletionReducerCreator,
} from '../../../src/short-urls/reducers/shortUrlDeletion';
} from '../../../src/shlink-web-component/short-urls/reducers/shortUrlDeletion';
describe('shortUrlDeletionReducer', () => {
const deleteShortUrlCall = vi.fn();

View File

@@ -1,9 +1,9 @@
import { fromPartial } from '@total-typescript/shoehorn';
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';
import type { ShortUrl } from '../../../src/shlink-web-component/short-urls/data';
import { shortUrlDetailReducerCreator } from '../../../src/shlink-web-component/short-urls/reducers/shortUrlDetail';
import type { ShortUrlsList } from '../../../src/shlink-web-component/short-urls/reducers/shortUrlsList';
describe('shortUrlDetailReducer', () => {
const getShortUrlCall = vi.fn();

View File

@@ -1,11 +1,11 @@
import { fromPartial } from '@total-typescript/shoehorn';
import type { ShlinkState } from '../../../src/container/types';
import type { SelectedServer } from '../../../src/servers/data';
import type { ShortUrl } from '../../../src/short-urls/data';
import type { ShortUrl } from '../../../src/shlink-web-component/short-urls/data';
import {
editShortUrl as editShortUrlCreator,
shortUrlEditionReducerCreator,
} from '../../../src/short-urls/reducers/shortUrlEdition';
} from '../../../src/shlink-web-component/short-urls/reducers/shortUrlEdition';
describe('shortUrlEditionReducer', () => {
const longUrl = 'https://shlink.io';

View File

@@ -1,16 +1,16 @@
import { fromPartial } from '@total-typescript/shoehorn';
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 type { ShortUrl } from '../../../src/shlink-web-component/short-urls/data';
import { createShortUrl as createShortUrlCreator } from '../../../src/shlink-web-component/short-urls/reducers/shortUrlCreation';
import { shortUrlDeleted } from '../../../src/shlink-web-component/short-urls/reducers/shortUrlDeletion';
import { editShortUrl as editShortUrlCreator } from '../../../src/shlink-web-component/short-urls/reducers/shortUrlEdition';
import {
listShortUrls as listShortUrlsCreator,
shortUrlsListReducerCreator,
} from '../../../src/short-urls/reducers/shortUrlsList';
import { createNewVisits } from '../../../src/visits/reducers/visitCreation';
import type { CreateVisit } from '../../../src/visits/types';
} from '../../../src/shlink-web-component/short-urls/reducers/shortUrlsList';
import { createNewVisits } from '../../../src/shlink-web-component/visits/reducers/visitCreation';
import type { CreateVisit } from '../../../src/shlink-web-component/visits/types';
describe('shortUrlsListReducer', () => {
const shortCode = 'abc123';