mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-10 09:33:51 +00:00
Updated to airbnb coding styles
This commit is contained in:
@@ -26,11 +26,11 @@ describe('<DomainRow />', () => {
|
||||
afterEach(() => wrapper?.unmount());
|
||||
|
||||
it.each([
|
||||
[ Mock.of<Domain>({ domain: '', isDefault: true }), undefined, 1, 1, 'defaultDomainBtn' ],
|
||||
[ Mock.of<Domain>({ domain: '', isDefault: false }), undefined, 0, 0, undefined ],
|
||||
[ Mock.of<Domain>({ domain: 'foo.com', isDefault: true }), undefined, 1, 1, 'defaultDomainBtn' ],
|
||||
[ Mock.of<Domain>({ domain: 'foo.bar.com', isDefault: true }), undefined, 1, 1, 'defaultDomainBtn' ],
|
||||
[ Mock.of<Domain>({ domain: 'foo.baz', isDefault: false }), undefined, 0, 0, undefined ],
|
||||
[Mock.of<Domain>({ domain: '', isDefault: true }), undefined, 1, 1, 'defaultDomainBtn'],
|
||||
[Mock.of<Domain>({ domain: '', isDefault: false }), undefined, 0, 0, undefined],
|
||||
[Mock.of<Domain>({ domain: 'foo.com', isDefault: true }), undefined, 1, 1, 'defaultDomainBtn'],
|
||||
[Mock.of<Domain>({ domain: 'foo.bar.com', isDefault: true }), undefined, 1, 1, 'defaultDomainBtn'],
|
||||
[Mock.of<Domain>({ domain: 'foo.baz', isDefault: false }), undefined, 0, 0, undefined],
|
||||
[
|
||||
Mock.of<Domain>({ domain: 'foo.baz', isDefault: true }),
|
||||
Mock.of<ReachableServer>({ version: '2.10.0' }),
|
||||
@@ -85,11 +85,11 @@ describe('<DomainRow />', () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
[ undefined, 3 ],
|
||||
[ Mock.of<ShlinkDomainRedirects>(), 3 ],
|
||||
[ Mock.of<ShlinkDomainRedirects>({ baseUrlRedirect: 'foo' }), 2 ],
|
||||
[ Mock.of<ShlinkDomainRedirects>({ invalidShortUrlRedirect: 'foo' }), 2 ],
|
||||
[ Mock.of<ShlinkDomainRedirects>({ baseUrlRedirect: 'foo', regular404Redirect: 'foo' }), 1 ],
|
||||
[undefined, 3],
|
||||
[Mock.of<ShlinkDomainRedirects>(), 3],
|
||||
[Mock.of<ShlinkDomainRedirects>({ baseUrlRedirect: 'foo' }), 2],
|
||||
[Mock.of<ShlinkDomainRedirects>({ invalidShortUrlRedirect: 'foo' }), 2],
|
||||
[Mock.of<ShlinkDomainRedirects>({ baseUrlRedirect: 'foo', regular404Redirect: 'foo' }), 1],
|
||||
[
|
||||
Mock.of<ShlinkDomainRedirects>(
|
||||
{ baseUrlRedirect: 'foo', regular404Redirect: 'foo', invalidShortUrlRedirect: 'foo' },
|
||||
|
||||
@@ -27,8 +27,8 @@ describe('<DomainSelector />', () => {
|
||||
afterEach(() => wrapper.unmount());
|
||||
|
||||
it.each([
|
||||
[ '', 'Domain', 'domains-dropdown__toggle-btn' ],
|
||||
[ 'my-domain.com', 'Domain: my-domain.com', 'domains-dropdown__toggle-btn--active' ],
|
||||
['', 'Domain', 'domains-dropdown__toggle-btn'],
|
||||
['my-domain.com', 'Domain: my-domain.com', 'domains-dropdown__toggle-btn--active'],
|
||||
])('shows dropdown by default', (value, expectedText, expectedClassName) => {
|
||||
const wrapper = createWrapper(value);
|
||||
const input = wrapper.find(InputGroup);
|
||||
@@ -54,9 +54,9 @@ describe('<DomainSelector />', () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
[ 0, 'default.com<span class="float-end text-muted">default</span>' ],
|
||||
[ 1, 'foo.com' ],
|
||||
[ 2, 'bar.com' ],
|
||||
[0, 'default.com<span class="float-end text-muted">default</span>'],
|
||||
[1, 'foo.com'],
|
||||
[2, 'bar.com'],
|
||||
])('shows expected content on every item', (index, expectedContent) => {
|
||||
const item = createWrapper().find(DropdownItem).at(index);
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ describe('<DomainStatusIcon />', () => {
|
||||
faTimes,
|
||||
'Oops! There is some missing configuration, and short URLs shared with this domain will not work.',
|
||||
],
|
||||
[ 'valid' as DomainStatus, faCheck, 'Congratulations! This domain is properly configured.' ],
|
||||
['valid' as DomainStatus, faCheck, 'Congratulations! This domain is properly configured.'],
|
||||
])('renders expected icon and tooltip when status is not validating', (status, expectedIcon, expectedText) => {
|
||||
const wrapper = createWrapper(status);
|
||||
const tooltip = wrapper.find(UncontrolledTooltip);
|
||||
@@ -59,8 +59,8 @@ describe('<DomainStatusIcon />', () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
[ true, 'top-start' ],
|
||||
[ false, 'left' ],
|
||||
[true, 'top-start'],
|
||||
[false, 'left'],
|
||||
])('places the tooltip properly based on query match', (isMobile, expectedPlacement) => {
|
||||
matchMedia.mockReturnValue(Mock.of<MediaQueryList>({ matches: isMobile }));
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ describe('domainsListReducer', () => {
|
||||
Mock.of<Domain>({ domain: 'foo', status: 'validating' }),
|
||||
Mock.of<Domain>({ domain: 'boo', status: 'validating' }),
|
||||
];
|
||||
const domains = [ ...filteredDomains, Mock.of<Domain>({ domain: 'bar', status: 'validating' }) ];
|
||||
const domains = [...filteredDomains, Mock.of<Domain>({ domain: 'bar', status: 'validating' })];
|
||||
|
||||
beforeEach(jest.clearAllMocks);
|
||||
|
||||
@@ -64,9 +64,9 @@ describe('domainsListReducer', () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
[ 'foo' ],
|
||||
[ 'bar' ],
|
||||
[ 'does_not_exist' ],
|
||||
['foo'],
|
||||
['bar'],
|
||||
['does_not_exist'],
|
||||
])('replaces redirects on proper domain on EDIT_DOMAIN_REDIRECTS', (domain) => {
|
||||
const redirects: ShlinkDomainRedirects = {
|
||||
baseUrlRedirect: 'bar',
|
||||
@@ -84,9 +84,9 @@ describe('domainsListReducer', () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
[ 'foo' ],
|
||||
[ 'bar' ],
|
||||
[ 'does_not_exist' ],
|
||||
['foo'],
|
||||
['bar'],
|
||||
['does_not_exist'],
|
||||
])('replaces status on proper domain on VALIDATE_DOMAIN', (domain) => {
|
||||
expect(reducer(
|
||||
Mock.of<DomainsList>({ domains, filteredDomains }),
|
||||
@@ -124,9 +124,9 @@ describe('domainsListReducer', () => {
|
||||
|
||||
describe('filterDomains', () => {
|
||||
it.each([
|
||||
[ 'foo' ],
|
||||
[ 'bar' ],
|
||||
[ 'something' ],
|
||||
['foo'],
|
||||
['bar'],
|
||||
['something'],
|
||||
])('creates action as expected', (searchTerm) => {
|
||||
expect(filterDomainsAction(searchTerm)).toEqual({ type: FILTER_DOMAINS, searchTerm });
|
||||
});
|
||||
@@ -166,8 +166,8 @@ describe('domainsListReducer', () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
[ 'pass', 'valid' ],
|
||||
[ 'fail', 'invalid' ],
|
||||
['pass', 'valid'],
|
||||
['fail', 'invalid'],
|
||||
])('dispatches proper status based on status returned from health endpoint', async (
|
||||
healthStatus,
|
||||
expectedStatus,
|
||||
|
||||
Reference in New Issue
Block a user