mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-21 14:06:19 +00:00
Move more components to shlink-web-component when applicable
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import type { ShlinkApiErrorProps } from '../../src/api/ShlinkApiError';
|
||||
import { ShlinkApiError } from '../../src/api/ShlinkApiError';
|
||||
import type { ShlinkApiErrorProps } from '../../shlink-web-component/common/ShlinkApiError';
|
||||
import { ShlinkApiError } from '../../shlink-web-component/common/ShlinkApiError';
|
||||
import type { InvalidArgumentError, ProblemDetailsError } from '../../src/api/types/errors';
|
||||
import { ErrorTypeV2, ErrorTypeV3 } from '../../src/api/types/errors';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { SimplePaginator } from '../../src/common/SimplePaginator';
|
||||
import { ELLIPSIS } from '../../src/utils/helpers/pagination';
|
||||
import { SimplePaginator } from '../../shlink-web-component/utils/components/SimplePaginator';
|
||||
import { ELLIPSIS } from '../../shlink-web-component/utils/helpers/pagination';
|
||||
|
||||
describe('<SimplePaginator />', () => {
|
||||
const setUp = (pagesCount: number, currentPage = 1) => render(
|
||||
|
||||
@@ -64,15 +64,4 @@ describe('HttpClient', () => {
|
||||
await expect(httpClient.fetchJson('')).rejects.toEqual(theError);
|
||||
});
|
||||
});
|
||||
|
||||
describe('fetchBlob', () => {
|
||||
it('returns response as blob', async () => {
|
||||
const theBlob = new Blob();
|
||||
fetch.mockResolvedValue({ blob: () => theBlob });
|
||||
|
||||
const result = await httpClient.fetchBlob('');
|
||||
|
||||
expect(result).toEqual(theBlob);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { ImageDownloader } from '../../../shlink-web-component/utils/services/ImageDownloader';
|
||||
import type { HttpClient } from '../../../src/common/services/HttpClient';
|
||||
import { ImageDownloader } from '../../../src/common/services/ImageDownloader';
|
||||
import { windowMock } from '../../__mocks__/Window.mock';
|
||||
|
||||
describe('ImageDownloader', () => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import type { MercureInfo } from '../../shlink-web-component/mercure/reducers/mercureInfo';
|
||||
import { Overview as overviewCreator } from '../../shlink-web-component/overview/Overview';
|
||||
import { prettify } from '../../src/utils/helpers/numbers';
|
||||
import { prettify } from '../../shlink-web-component/utils/helpers/numbers';
|
||||
import { renderWithEvents } from '../__helpers__/setUpTest';
|
||||
|
||||
describe('<Overview />', () => {
|
||||
|
||||
@@ -2,8 +2,8 @@ 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/short-urls/Paginator';
|
||||
import { ELLIPSIS } from '../../shlink-web-component/utils/helpers/pagination';
|
||||
import type { ShlinkPaginator } from '../../src/api/types';
|
||||
import { ELLIPSIS } from '../../src/utils/helpers/pagination';
|
||||
|
||||
describe('<Paginator />', () => {
|
||||
const buildPaginator = (pagesCount?: number) => fromPartial<ShlinkPaginator>({ pagesCount, currentPage: 1 });
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { screen } from '@testing-library/react';
|
||||
import { QrErrorCorrectionDropdown } from '../../../../shlink-web-component/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown';
|
||||
import type { QrErrorCorrection } from '../../../../src/utils/helpers/qrCodes';
|
||||
import type { QrErrorCorrection } from '../../../../shlink-web-component/utils/helpers/qrCodes';
|
||||
import { renderWithEvents } from '../../../__helpers__/setUpTest';
|
||||
|
||||
describe('<QrErrorCorrectionDropdown />', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { screen } from '@testing-library/react';
|
||||
import { QrFormatDropdown } from '../../../../shlink-web-component/short-urls/helpers/qr-codes/QrFormatDropdown';
|
||||
import type { QrCodeFormat } from '../../../../src/utils/helpers/qrCodes';
|
||||
import type { QrCodeFormat } from '../../../../shlink-web-component/utils/helpers/qrCodes';
|
||||
import { renderWithEvents } from '../../../__helpers__/setUpTest';
|
||||
|
||||
describe('<QrFormatDropdown />', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CopyToClipboardIcon } from '../../src/utils/CopyToClipboardIcon';
|
||||
import { CopyToClipboardIcon } from '../../shlink-web-component/utils/components/CopyToClipboardIcon';
|
||||
import { renderWithEvents } from '../__helpers__/setUpTest';
|
||||
|
||||
describe('<CopyToClipboardIcon />', () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { ExportBtn } from '../../src/utils/ExportBtn';
|
||||
import { ExportBtn } from '../../shlink-web-component/utils/components/ExportBtn';
|
||||
|
||||
describe('<ExportBtn />', () => {
|
||||
const setUp = (amount?: number, loading = false) => render(<ExportBtn amount={amount} loading={loading} />);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Placement } from '@popperjs/core';
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import type { InfoTooltipProps } from '../../src/utils/InfoTooltip';
|
||||
import { InfoTooltip } from '../../src/utils/InfoTooltip';
|
||||
import type { InfoTooltipProps } from '../../shlink-web-component/utils/components/InfoTooltip';
|
||||
import { InfoTooltip } from '../../shlink-web-component/utils/components/InfoTooltip';
|
||||
import { renderWithEvents } from '../__helpers__/setUpTest';
|
||||
|
||||
describe('<InfoTooltip />', () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { screen } from '@testing-library/react';
|
||||
import { PaginationDropdown } from '../../src/utils/PaginationDropdown';
|
||||
import { PaginationDropdown } from '../../shlink-web-component/utils/components/PaginationDropdown';
|
||||
import { renderWithEvents } from '../__helpers__/setUpTest';
|
||||
|
||||
describe('<PaginationDropdown />', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { roundTen } from '../../../src/utils/helpers/numbers';
|
||||
import { roundTen } from '../../../shlink-web-component/utils/helpers/numbers';
|
||||
|
||||
describe('numbers', () => {
|
||||
describe('roundTen', () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { QrCodeFormat, QrErrorCorrection } from '../../../src/utils/helpers/qrCodes';
|
||||
import { buildQrCodeUrl } from '../../../src/utils/helpers/qrCodes';
|
||||
import type { QrCodeFormat, QrErrorCorrection } from '../../../shlink-web-component/utils/helpers/qrCodes';
|
||||
import { buildQrCodeUrl } from '../../../shlink-web-component/utils/helpers/qrCodes';
|
||||
|
||||
describe('qrCodes', () => {
|
||||
describe('buildQrCodeUrl', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { render } from '@testing-library/react';
|
||||
import { TableOrderIcon } from '../../../shlink-web-component/utils/table/TableOrderIcon';
|
||||
import type { OrderDir } from '../../../src/utils/helpers/ordering';
|
||||
import { TableOrderIcon } from '../../../src/utils/table/TableOrderIcon';
|
||||
|
||||
describe('<TableOrderIcon />', () => {
|
||||
const setUp = (field: string, currentDir?: OrderDir, className?: string) => render(
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
capitalize,
|
||||
nonEmptyValueOrNull,
|
||||
parseBooleanToString,
|
||||
parseOptionalBooleanToString,
|
||||
@@ -45,17 +44,6 @@ describe('utils', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('capitalize', () => {
|
||||
it.each([
|
||||
['foo', 'Foo'],
|
||||
['BAR', 'BAR'],
|
||||
['bAZ', 'BAZ'],
|
||||
['with spaces', 'With spaces'],
|
||||
])('sets first letter in uppercase', (value, expectedResult) => {
|
||||
expect(capitalize(value)).toEqual(expectedResult);
|
||||
});
|
||||
});
|
||||
|
||||
describe('parseBooleanToString', () => {
|
||||
it.each([
|
||||
[true, 'true'],
|
||||
|
||||
Reference in New Issue
Block a user