mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-05-28 16:16:24 +00:00
Updated to airbnb coding styles
This commit is contained in:
@@ -60,7 +60,7 @@ describe('shortUrlDeletionReducer', () => {
|
||||
});
|
||||
|
||||
it.each(
|
||||
[[ undefined ], [ null ], [ 'example.com' ]],
|
||||
[[undefined], [null], ['example.com']],
|
||||
)('dispatches proper actions if API client request succeeds', async (domain) => {
|
||||
const apiClientMock = Mock.of<ShlinkApiClient>({
|
||||
deleteShortUrl: jest.fn(() => ''),
|
||||
|
||||
@@ -62,8 +62,8 @@ describe('shortUrlDetailReducer', () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
[ undefined ],
|
||||
[ Mock.all<ShortUrlsList>() ],
|
||||
[undefined],
|
||||
[Mock.all<ShortUrlsList>()],
|
||||
[
|
||||
Mock.of<ShortUrlsList>({
|
||||
shortUrls: { data: [] },
|
||||
@@ -72,7 +72,7 @@ describe('shortUrlDetailReducer', () => {
|
||||
[
|
||||
Mock.of<ShortUrlsList>({
|
||||
shortUrls: {
|
||||
data: [ Mock.of<ShortUrl>({ shortCode: 'this_will_not_match' }) ],
|
||||
data: [Mock.of<ShortUrl>({ shortCode: 'this_will_not_match' })],
|
||||
},
|
||||
}),
|
||||
],
|
||||
@@ -96,7 +96,7 @@ describe('shortUrlDetailReducer', () => {
|
||||
dispatchMock,
|
||||
buildGetState(Mock.of<ShortUrlsList>({
|
||||
shortUrls: {
|
||||
data: [ foundShortUrl ],
|
||||
data: [foundShortUrl],
|
||||
},
|
||||
})),
|
||||
);
|
||||
|
||||
@@ -48,7 +48,7 @@ describe('shortUrlEditionReducer', () => {
|
||||
|
||||
afterEach(jest.clearAllMocks);
|
||||
|
||||
it.each([[ undefined ], [ null ], [ 'example.com' ]])('dispatches short URL on success', async (domain) => {
|
||||
it.each([[undefined], [null], ['example.com']])('dispatches short URL on success', async (domain) => {
|
||||
await editShortUrl(buildShlinkApiClient)(shortCode, domain, { longUrl })(dispatch, createGetState());
|
||||
|
||||
expect(buildShlinkApiClient).toHaveBeenCalledTimes(1);
|
||||
@@ -60,12 +60,12 @@ describe('shortUrlEditionReducer', () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
[ null, { tags: [ 'foo', 'bar' ] }, 1 ],
|
||||
[ null, {}, 0 ],
|
||||
[ Mock.of<ReachableServer>({ version: '2.6.0' }), {}, 0 ],
|
||||
[ Mock.of<ReachableServer>({ version: '2.6.0' }), { tags: [ 'foo', 'bar' ] }, 0 ],
|
||||
[ Mock.of<ReachableServer>({ version: '2.5.0' }), {}, 0 ],
|
||||
[ Mock.of<ReachableServer>({ version: '2.5.0' }), { tags: [ 'foo', 'bar' ] }, 1 ],
|
||||
[null, { tags: ['foo', 'bar'] }, 1],
|
||||
[null, {}, 0],
|
||||
[Mock.of<ReachableServer>({ version: '2.6.0' }), {}, 0],
|
||||
[Mock.of<ReachableServer>({ version: '2.6.0' }), { tags: ['foo', 'bar'] }, 0],
|
||||
[Mock.of<ReachableServer>({ version: '2.5.0' }), {}, 0],
|
||||
[Mock.of<ReachableServer>({ version: '2.5.0' }), { tags: ['foo', 'bar'] }, 1],
|
||||
])(
|
||||
'sends tags separately when appropriate, based on selected server and the payload',
|
||||
async (server, payload, expectedTagsCalls) => {
|
||||
|
||||
@@ -67,11 +67,11 @@ describe('shortUrlsListReducer', () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
[[ createNewShortUrlVisit(11) ], 11 ],
|
||||
[[ createNewShortUrlVisit(30) ], 30 ],
|
||||
[[ createNewShortUrlVisit(20), createNewShortUrlVisit(40) ], 40 ],
|
||||
[[{}], 10 ],
|
||||
[[], 10 ],
|
||||
[[createNewShortUrlVisit(11)], 11],
|
||||
[[createNewShortUrlVisit(30)], 30],
|
||||
[[createNewShortUrlVisit(20), createNewShortUrlVisit(40)], 40],
|
||||
[[{}], 10],
|
||||
[[], 10],
|
||||
])('updates visits count on CREATE_VISITS', (createdVisits, expectedCount) => {
|
||||
const state = {
|
||||
shortUrls: Mock.of<ShlinkShortUrlsResponse>({
|
||||
@@ -155,9 +155,9 @@ describe('shortUrlsListReducer', () => {
|
||||
it.each([
|
||||
((): [ShortUrl, ShortUrl[], ShortUrl[]] => {
|
||||
const editedShortUrl = Mock.of<ShortUrl>({ shortCode: 'notMatching' });
|
||||
const list = [ Mock.of<ShortUrl>({ shortCode: 'foo' }), Mock.of<ShortUrl>({ shortCode: 'bar' }) ];
|
||||
const list = [Mock.of<ShortUrl>({ shortCode: 'foo' }), Mock.of<ShortUrl>({ shortCode: 'bar' })];
|
||||
|
||||
return [ editedShortUrl, list, list ];
|
||||
return [editedShortUrl, list, list];
|
||||
})(),
|
||||
((): [ShortUrl, ShortUrl[], ShortUrl[]] => {
|
||||
const editedShortUrl = Mock.of<ShortUrl>({ shortCode: 'matching', longUrl: 'new_one' });
|
||||
@@ -165,9 +165,9 @@ describe('shortUrlsListReducer', () => {
|
||||
Mock.of<ShortUrl>({ shortCode: 'matching', longUrl: 'old_one' }),
|
||||
Mock.of<ShortUrl>({ shortCode: 'bar' }),
|
||||
];
|
||||
const expectedList = [ editedShortUrl, list[1] ];
|
||||
const expectedList = [editedShortUrl, list[1]];
|
||||
|
||||
return [ editedShortUrl, list, expectedList ];
|
||||
return [editedShortUrl, list, expectedList];
|
||||
})(),
|
||||
])('updates matching short URL on SHORT_URL_EDITED', (editedShortUrl, initialList, expectedList) => {
|
||||
const state = {
|
||||
|
||||
Reference in New Issue
Block a user