mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-19 21:16:18 +00:00
Removed some version checks for versions older than 2.4.0
This commit is contained in:
@@ -49,8 +49,6 @@ describe('<MenuLayout />', () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
[ '2.1.0' as SemVer, 7 ],
|
||||
[ '2.2.0' as SemVer, 8 ],
|
||||
[ '2.5.0' as SemVer, 8 ],
|
||||
[ '2.6.0' as SemVer, 9 ],
|
||||
[ '2.7.0' as SemVer, 9 ],
|
||||
|
||||
@@ -13,9 +13,10 @@ import { parseDate } from '../../src/utils/helpers/date';
|
||||
describe('<ShortUrlForm />', () => {
|
||||
let wrapper: ShallowWrapper;
|
||||
const TagsSelector = () => null;
|
||||
const DomainSelector = () => null;
|
||||
const createShortUrl = jest.fn(async () => Promise.resolve());
|
||||
const createWrapper = (selectedServer: SelectedServer = null, mode: Mode = 'create') => {
|
||||
const ShortUrlForm = createShortUrlForm(TagsSelector, () => null);
|
||||
const ShortUrlForm = createShortUrlForm(TagsSelector, DomainSelector);
|
||||
|
||||
wrapper = shallow(
|
||||
<ShortUrlForm
|
||||
@@ -41,7 +42,7 @@ describe('<ShortUrlForm />', () => {
|
||||
wrapper.find(Input).first().simulate('change', { target: { value: 'https://long-domain.com/foo/bar' } });
|
||||
wrapper.find('TagsSelector').simulate('change', [ 'tag_foo', 'tag_bar' ]);
|
||||
wrapper.find('#customSlug').simulate('change', { target: { value: 'my-slug' } });
|
||||
wrapper.find('#domain').simulate('change', { target: { value: 'example.com' } });
|
||||
wrapper.find(DomainSelector).simulate('change', 'example.com');
|
||||
wrapper.find('#maxVisits').simulate('change', { target: { value: '20' } });
|
||||
wrapper.find('#shortCodeLength').simulate('change', { target: { value: 15 } });
|
||||
wrapper.find(DateInput).at(0).simulate('change', validSince);
|
||||
@@ -68,12 +69,8 @@ describe('<ShortUrlForm />', () => {
|
||||
[ null, 'create-basic' as Mode, 0 ],
|
||||
[ Mock.of<ReachableServer>({ version: '2.6.0' }), 'create' as Mode, 4 ],
|
||||
[ Mock.of<ReachableServer>({ version: '2.5.0' }), 'create' as Mode, 4 ],
|
||||
[ Mock.of<ReachableServer>({ version: '2.4.0' }), 'create' as Mode, 4 ],
|
||||
[ Mock.of<ReachableServer>({ version: '2.3.0' }), 'create' as Mode, 4 ],
|
||||
[ Mock.of<ReachableServer>({ version: '2.6.0' }), 'edit' as Mode, 4 ],
|
||||
[ Mock.of<ReachableServer>({ version: '2.5.0' }), 'edit' as Mode, 3 ],
|
||||
[ Mock.of<ReachableServer>({ version: '2.4.0' }), 'edit' as Mode, 3 ],
|
||||
[ Mock.of<ReachableServer>({ version: '2.3.0' }), 'edit' as Mode, 2 ],
|
||||
])(
|
||||
'renders expected amount of cards based on server capabilities and mode',
|
||||
(selectedServer, mode, expectedAmountOfCards) => {
|
||||
|
||||
@@ -43,9 +43,6 @@ describe('<QrCodeModal />', () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
[ '2.3.0' as SemVer, 0, '/qr-code/300' ],
|
||||
[ '2.4.0' as SemVer, 0, '/qr-code/300?format=png' ],
|
||||
[ '2.4.0' as SemVer, 10, '/qr-code/300?format=png' ],
|
||||
[ '2.5.0' as SemVer, 0, '/qr-code?size=300&format=png' ],
|
||||
[ '2.6.0' as SemVer, 0, '/qr-code?size=300&format=png' ],
|
||||
[ '2.6.0' as SemVer, 10, '/qr-code?size=300&format=png&margin=10' ],
|
||||
@@ -90,8 +87,6 @@ describe('<QrCodeModal />', () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
[ '2.3.0' as SemVer, 0, 'col-12' ],
|
||||
[ '2.4.0' as SemVer, 1, 'col-md-6' ],
|
||||
[ '2.6.0' as SemVer, 1, 'col-md-4' ],
|
||||
[ '2.8.0' as SemVer, 2, 'col-md-6' ],
|
||||
])('shows expected components based on server version', (version, expectedAmountOfDropdowns, expectedRangeClass) => {
|
||||
|
||||
@@ -6,67 +6,67 @@ describe('qrCodes', () => {
|
||||
[
|
||||
'foo.com',
|
||||
{ size: 530, format: 'svg' as QrCodeFormat, margin: 0, errorCorrection: 'L' as QrErrorCorrection },
|
||||
{ useSizeInPath: true, svgIsSupported: true, marginIsSupported: false, errorCorrectionIsSupported: false },
|
||||
{ useSizeInPath: true, marginIsSupported: false, errorCorrectionIsSupported: false },
|
||||
'foo.com/qr-code/530?format=svg',
|
||||
],
|
||||
[
|
||||
'foo.com',
|
||||
{ size: 530, format: 'png' as QrCodeFormat, margin: 0, errorCorrection: 'L' as QrErrorCorrection },
|
||||
{ useSizeInPath: true, svgIsSupported: true, marginIsSupported: false, errorCorrectionIsSupported: false },
|
||||
{ useSizeInPath: true, marginIsSupported: false, errorCorrectionIsSupported: false },
|
||||
'foo.com/qr-code/530?format=png',
|
||||
],
|
||||
[
|
||||
'bar.io',
|
||||
{ size: 870, format: 'svg' as QrCodeFormat, margin: 0, errorCorrection: 'L' as QrErrorCorrection },
|
||||
{ useSizeInPath: false, svgIsSupported: false, marginIsSupported: false, errorCorrectionIsSupported: false },
|
||||
'bar.io/qr-code?size=870',
|
||||
{ useSizeInPath: false, marginIsSupported: false, errorCorrectionIsSupported: false },
|
||||
'bar.io/qr-code?size=870&format=svg',
|
||||
],
|
||||
[
|
||||
'bar.io',
|
||||
{ size: 200, format: 'png' as QrCodeFormat, margin: 0, errorCorrection: 'L' as QrErrorCorrection },
|
||||
{ useSizeInPath: false, svgIsSupported: true, marginIsSupported: false, errorCorrectionIsSupported: false },
|
||||
{ useSizeInPath: false, marginIsSupported: false, errorCorrectionIsSupported: false },
|
||||
'bar.io/qr-code?size=200&format=png',
|
||||
],
|
||||
[
|
||||
'bar.io',
|
||||
{ size: 200, format: 'svg' as QrCodeFormat, margin: 0, errorCorrection: 'L' as QrErrorCorrection },
|
||||
{ useSizeInPath: false, svgIsSupported: true, marginIsSupported: false, errorCorrectionIsSupported: false },
|
||||
{ useSizeInPath: false, marginIsSupported: false, errorCorrectionIsSupported: false },
|
||||
'bar.io/qr-code?size=200&format=svg',
|
||||
],
|
||||
[
|
||||
'foo.net',
|
||||
{ size: 480, format: 'png' as QrCodeFormat, margin: 0, errorCorrection: 'L' as QrErrorCorrection },
|
||||
{ useSizeInPath: true, svgIsSupported: false, marginIsSupported: false, errorCorrectionIsSupported: false },
|
||||
'foo.net/qr-code/480',
|
||||
{ useSizeInPath: true, marginIsSupported: false, errorCorrectionIsSupported: false },
|
||||
'foo.net/qr-code/480?format=png',
|
||||
],
|
||||
[
|
||||
'foo.net',
|
||||
{ size: 480, format: 'svg' as QrCodeFormat, margin: 0, errorCorrection: 'L' as QrErrorCorrection },
|
||||
{ useSizeInPath: true, svgIsSupported: false, marginIsSupported: false, errorCorrectionIsSupported: false },
|
||||
'foo.net/qr-code/480',
|
||||
{ useSizeInPath: true, marginIsSupported: false, errorCorrectionIsSupported: false },
|
||||
'foo.net/qr-code/480?format=svg',
|
||||
],
|
||||
[
|
||||
'shlink.io',
|
||||
{ size: 123, format: 'svg' as QrCodeFormat, margin: 10, errorCorrection: 'L' as QrErrorCorrection },
|
||||
{ useSizeInPath: true, svgIsSupported: false, marginIsSupported: false, errorCorrectionIsSupported: false },
|
||||
'shlink.io/qr-code/123',
|
||||
{ useSizeInPath: true, marginIsSupported: false, errorCorrectionIsSupported: false },
|
||||
'shlink.io/qr-code/123?format=svg',
|
||||
],
|
||||
[
|
||||
'shlink.io',
|
||||
{ size: 456, format: 'png' as QrCodeFormat, margin: 10, errorCorrection: 'L' as QrErrorCorrection },
|
||||
{ useSizeInPath: true, svgIsSupported: true, marginIsSupported: true, errorCorrectionIsSupported: false },
|
||||
{ useSizeInPath: true, marginIsSupported: true, errorCorrectionIsSupported: false },
|
||||
'shlink.io/qr-code/456?format=png&margin=10',
|
||||
],
|
||||
[
|
||||
'shlink.io',
|
||||
{ size: 456, format: 'png' as QrCodeFormat, margin: 0, errorCorrection: 'L' as QrErrorCorrection },
|
||||
{ useSizeInPath: true, svgIsSupported: true, marginIsSupported: true, errorCorrectionIsSupported: false },
|
||||
{ useSizeInPath: true, marginIsSupported: true, errorCorrectionIsSupported: false },
|
||||
'shlink.io/qr-code/456?format=png',
|
||||
],
|
||||
[
|
||||
'shlink.io',
|
||||
{ size: 456, format: 'png' as QrCodeFormat, margin: 0, errorCorrection: 'H' as QrErrorCorrection },
|
||||
{ useSizeInPath: true, svgIsSupported: true, marginIsSupported: true, errorCorrectionIsSupported: true },
|
||||
{ useSizeInPath: true, marginIsSupported: true, errorCorrectionIsSupported: true },
|
||||
'shlink.io/qr-code/456?format=png&errorCorrection=H',
|
||||
],
|
||||
])('builds expected URL based in params', (shortUrl, options, capabilities, expectedUrl) => {
|
||||
|
||||
Reference in New Issue
Block a user