mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-19 21:16:18 +00:00
Remove more ovbious ramda helper usages
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { screen } from '@testing-library/react';
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { values } from 'ramda';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import type { ServersMap } from '../../src/servers/data';
|
||||
import { ServersDropdown } from '../../src/servers/ServersDropdown';
|
||||
@@ -28,7 +27,7 @@ describe('<ServersDropdown />', () => {
|
||||
|
||||
await user.click(screen.getByText('Servers'));
|
||||
const items = screen.getAllByRole('menuitem');
|
||||
expect(items).toHaveLength(values(fallbackServers).length + 1);
|
||||
expect(items).toHaveLength(Object.values(fallbackServers).length + 1);
|
||||
expect(items[0]).toHaveTextContent('foo');
|
||||
expect(items[1]).toHaveTextContent('bar');
|
||||
expect(items[2]).toHaveTextContent('baz');
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { dissoc, values } from 'ramda';
|
||||
import type { RegularServer, ServersMap, ServerWithId } from '../../../src/servers/data';
|
||||
import {
|
||||
createServers,
|
||||
@@ -101,17 +100,17 @@ describe('serversReducer', () => {
|
||||
|
||||
describe('createServers', () => {
|
||||
it('returns expected action', () => {
|
||||
const newServers = values(list);
|
||||
const newServers = Object.values(list);
|
||||
const { payload } = createServers(newServers);
|
||||
|
||||
expect(payload).toEqual(list);
|
||||
});
|
||||
|
||||
it('generates an id for every provided server if they do not have it', () => {
|
||||
const servers = values(list).map(dissoc('id'));
|
||||
const servers = Object.values(list).map(({ id, ...rest }) => rest);
|
||||
const { payload } = createServers(servers);
|
||||
|
||||
expect(values(payload).every(({ id }) => !!id)).toEqual(true);
|
||||
expect(Object.values(payload).every(({ id }) => !!id)).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user