mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-18 05:23:49 +00:00
Migrated EditShortUrl test to react testing library
This commit is contained in:
28
test/short-urls/helpers/index.test.ts
Normal file
28
test/short-urls/helpers/index.test.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { Mock } from 'ts-mockery';
|
||||
import { ShortUrl } from '../../../src/short-urls/data';
|
||||
import { shortUrlDataFromShortUrl } from '../../../src/short-urls/helpers';
|
||||
|
||||
describe('helpers', () => {
|
||||
describe('shortUrlDataFromShortUrl', () => {
|
||||
it.each([
|
||||
[undefined, { validateUrls: true }, { longUrl: '', validateUrl: true }],
|
||||
[undefined, undefined, { longUrl: '', validateUrl: false }],
|
||||
[
|
||||
Mock.of<ShortUrl>({ meta: {} }),
|
||||
{ validateUrls: false },
|
||||
{
|
||||
longUrl: undefined,
|
||||
tags: undefined,
|
||||
title: undefined,
|
||||
domain: undefined,
|
||||
validSince: undefined,
|
||||
validUntil: undefined,
|
||||
maxVisits: undefined,
|
||||
validateUrl: false,
|
||||
},
|
||||
],
|
||||
])('returns expected data', (shortUrl, settings, expectedInitialState) => {
|
||||
expect(shortUrlDataFromShortUrl(shortUrl, settings)).toEqual(expectedInitialState);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user