Updated to airbnb coding styles

This commit is contained in:
Alejandro Celaya
2022-03-26 12:17:42 +01:00
parent 4e9b19afd1
commit a2df486280
239 changed files with 2210 additions and 3549 deletions

View File

@@ -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' },

View File

@@ -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);

View File

@@ -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 }));

View File

@@ -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,