Add Shlink prefix to api-contract models

This commit is contained in:
Alejandro Celaya
2023-08-06 21:27:57 +02:00
parent 47dd105cd6
commit 23daa2de72
35 changed files with 160 additions and 159 deletions

View File

@@ -1,7 +1,7 @@
import { render, screen } from '@testing-library/react';
import { fromPartial } from '@total-typescript/shoehorn';
import { MemoryRouter } from 'react-router-dom';
import type { ShortUrl } from '../../../src/short-urls/data';
import type { ShlinkShortUrl } from '../../../src/short-urls/data';
import type { LinkSuffix } from '../../../src/short-urls/helpers/ShortUrlDetailLink';
import { ShortUrlDetailLink } from '../../../src/short-urls/helpers/ShortUrlDetailLink';
import { RoutesPrefixProvider } from '../../../src/utils/routesPrefix';
@@ -12,8 +12,8 @@ describe('<ShortUrlDetailLink />', () => {
[false, null],
[true, null],
[true, undefined],
[false, fromPartial<ShortUrl>({})],
[false, fromPartial<ShortUrl>({})],
[false, fromPartial<ShlinkShortUrl>({})],
[false, fromPartial<ShlinkShortUrl>({})],
])('only renders a plain span when either server or short URL are not set', (asLink, shortUrl) => {
render(
<ShortUrlDetailLink shortUrl={shortUrl} asLink={asLink} suffix="visits">
@@ -28,25 +28,25 @@ describe('<ShortUrlDetailLink />', () => {
it.each([
[
'/server/1',
fromPartial<ShortUrl>({ shortCode: 'abc123' }),
fromPartial<ShlinkShortUrl>({ shortCode: 'abc123' }),
'visits' as LinkSuffix,
'/server/1/short-code/abc123/visits',
],
[
'/foobar',
fromPartial<ShortUrl>({ shortCode: 'def456', domain: 'example.com' }),
fromPartial<ShlinkShortUrl>({ shortCode: 'def456', domain: 'example.com' }),
'visits' as LinkSuffix,
'/foobar/short-code/def456/visits?domain=example.com',
],
[
'/server/1',
fromPartial<ShortUrl>({ shortCode: 'abc123' }),
fromPartial<ShlinkShortUrl>({ shortCode: 'abc123' }),
'edit' as LinkSuffix,
'/server/1/short-code/abc123/edit',
],
[
'/server/3',
fromPartial<ShortUrl>({ shortCode: 'def456', domain: 'example.com' }),
fromPartial<ShlinkShortUrl>({ shortCode: 'def456', domain: 'example.com' }),
'edit' as LinkSuffix,
'/server/3/short-code/def456/edit?domain=example.com',
],