mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-21 14:06:19 +00:00
Add Shlink prefix to api-contract models
This commit is contained in:
@@ -2,41 +2,41 @@ 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-contract';
|
||||
import type { ShortUrl, ShortUrlMeta } from '../../../src/short-urls/data';
|
||||
import type { ShlinkShortUrlMeta, ShlinkShortUrl } from '../../../src/short-urls/data';
|
||||
import { ShortUrlStatus } from '../../../src/short-urls/helpers/ShortUrlStatus';
|
||||
|
||||
describe('<ShortUrlStatus />', () => {
|
||||
const setUp = (shortUrl: ShortUrl) => ({
|
||||
const setUp = (shortUrl: ShlinkShortUrl) => ({
|
||||
user: userEvent.setup(),
|
||||
...render(<ShortUrlStatus shortUrl={shortUrl} />),
|
||||
});
|
||||
|
||||
it.each([
|
||||
[
|
||||
fromPartial<ShortUrlMeta>({ validSince: '2099-01-01T10:30:15' }),
|
||||
fromPartial<ShlinkShortUrlMeta>({ validSince: '2099-01-01T10:30:15' }),
|
||||
{},
|
||||
'This short URL will start working on 2099-01-01 10:30.',
|
||||
],
|
||||
[
|
||||
fromPartial<ShortUrlMeta>({ validUntil: '2020-01-01T10:30:15' }),
|
||||
fromPartial<ShlinkShortUrlMeta>({ validUntil: '2020-01-01T10:30:15' }),
|
||||
{},
|
||||
'This short URL cannot be visited since 2020-01-01 10:30.',
|
||||
],
|
||||
[
|
||||
fromPartial<ShortUrlMeta>({ maxVisits: 10 }),
|
||||
fromPartial<ShlinkShortUrlMeta>({ maxVisits: 10 }),
|
||||
fromPartial<ShlinkVisitsSummary>({ total: 10 }),
|
||||
'This short URL cannot be currently visited because it has reached the maximum amount of 10 visits.',
|
||||
],
|
||||
[
|
||||
fromPartial<ShortUrlMeta>({ maxVisits: 1 }),
|
||||
fromPartial<ShlinkShortUrlMeta>({ maxVisits: 1 }),
|
||||
fromPartial<ShlinkVisitsSummary>({ total: 1 }),
|
||||
'This short URL cannot be currently visited because it has reached the maximum amount of 1 visit.',
|
||||
],
|
||||
[{}, {}, 'This short URL can be visited normally.'],
|
||||
[fromPartial<ShortUrlMeta>({ validUntil: '2099-01-01T10:30:15' }), {}, 'This short URL can be visited normally.'],
|
||||
[fromPartial<ShortUrlMeta>({ validSince: '2020-01-01T10:30:15' }), {}, 'This short URL can be visited normally.'],
|
||||
[fromPartial<ShlinkShortUrlMeta>({ validUntil: '2099-01-01T10:30:15' }), {}, 'This short URL can be visited normally.'],
|
||||
[fromPartial<ShlinkShortUrlMeta>({ validSince: '2020-01-01T10:30:15' }), {}, 'This short URL can be visited normally.'],
|
||||
[
|
||||
fromPartial<ShortUrlMeta>({ maxVisits: 10 }),
|
||||
fromPartial<ShlinkShortUrlMeta>({ maxVisits: 10 }),
|
||||
fromPartial<ShlinkVisitsSummary>({ total: 1 }),
|
||||
'This short URL can be visited normally.',
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user