mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-21 05:56:20 +00:00
Updated styles in javascript to fulfill adidas rules
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
import { ShlinkApiClient } from '../../src/api/ShlinkApiClient'
|
||||
import sinon from 'sinon';
|
||||
import { head, last } from 'ramda';
|
||||
import { ShlinkApiClient } from '../../src/api/ShlinkApiClient';
|
||||
|
||||
describe('ShlinkApiClient', () => {
|
||||
const createAxiosMock = extraData => () =>
|
||||
const createAxiosMock = (extraData) => () =>
|
||||
Promise.resolve({
|
||||
headers: { authorization: 'Bearer abc123' },
|
||||
headers: { authorization: 'Bearer abc123' },
|
||||
data: { token: 'abc123' },
|
||||
...extraData,
|
||||
});
|
||||
const createApiClient = extraData =>
|
||||
const createApiClient = (extraData) =>
|
||||
new ShlinkApiClient(createAxiosMock(extraData));
|
||||
|
||||
describe('listShortUrls', () => {
|
||||
it('properly returns short URLs list', async () => {
|
||||
const expectedList = ['foo', 'bar'];
|
||||
const expectedList = [ 'foo', 'bar' ];
|
||||
|
||||
const apiClient = createApiClient({
|
||||
data: {
|
||||
@@ -23,6 +23,7 @@ describe('ShlinkApiClient', () => {
|
||||
});
|
||||
|
||||
const actualList = await apiClient.listShortUrls();
|
||||
|
||||
expect(expectedList).toEqual(actualList);
|
||||
});
|
||||
});
|
||||
@@ -35,6 +36,7 @@ describe('ShlinkApiClient', () => {
|
||||
it('returns create short URL', async () => {
|
||||
const apiClient = createApiClient({ data: shortUrl });
|
||||
const result = await apiClient.createShortUrl({});
|
||||
|
||||
expect(result).toEqual(shortUrl);
|
||||
});
|
||||
|
||||
@@ -54,7 +56,7 @@ describe('ShlinkApiClient', () => {
|
||||
|
||||
describe('getShortUrlVisits', () => {
|
||||
it('properly returns short URL visits', async () => {
|
||||
const expectedVisits = ['foo', 'bar'];
|
||||
const expectedVisits = [ 'foo', 'bar' ];
|
||||
const axiosSpy = sinon.spy(createAxiosMock({
|
||||
data: {
|
||||
visits: {
|
||||
@@ -94,7 +96,7 @@ describe('ShlinkApiClient', () => {
|
||||
|
||||
describe('updateShortUrlTags', () => {
|
||||
it('properly updates short URL tags', async () => {
|
||||
const expectedTags = ['foo', 'bar'];
|
||||
const expectedTags = [ 'foo', 'bar' ];
|
||||
const axiosSpy = sinon.spy(createAxiosMock({
|
||||
data: { tags: expectedTags },
|
||||
}));
|
||||
@@ -112,10 +114,10 @@ describe('ShlinkApiClient', () => {
|
||||
|
||||
describe('listTags', () => {
|
||||
it('properly returns list of tags', async () => {
|
||||
const expectedTags = ['foo', 'bar'];
|
||||
const expectedTags = [ 'foo', 'bar' ];
|
||||
const axiosSpy = sinon.spy(createAxiosMock({
|
||||
data: {
|
||||
tags: { data: expectedTags }
|
||||
tags: { data: expectedTags },
|
||||
},
|
||||
}));
|
||||
const apiClient = new ShlinkApiClient(axiosSpy);
|
||||
@@ -132,7 +134,7 @@ describe('ShlinkApiClient', () => {
|
||||
|
||||
describe('deleteTags', () => {
|
||||
it('properly deletes provided tags', async () => {
|
||||
const tags = ['foo', 'bar'];
|
||||
const tags = [ 'foo', 'bar' ];
|
||||
const axiosSpy = sinon.spy(createAxiosMock({}));
|
||||
const apiClient = new ShlinkApiClient(axiosSpy);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { shallow } from 'enzyme'
|
||||
import React from 'react'
|
||||
import AsideMenu from '../../src/common/AsideMenu'
|
||||
import { shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
import { NavLink } from 'react-router-dom';
|
||||
import AsideMenu from '../../src/common/AsideMenu';
|
||||
|
||||
describe('<AsideMenu />', () => {
|
||||
let wrapped;
|
||||
@@ -15,9 +15,10 @@ describe('<AsideMenu />', () => {
|
||||
|
||||
it('contains links to different sections', () => {
|
||||
const links = wrapped.find(NavLink);
|
||||
const expectedLength = 3;
|
||||
|
||||
expect(links).toHaveLength(3);
|
||||
links.forEach(link => expect(link.prop('to')).toContain('abc123'));
|
||||
expect(links).toHaveLength(expectedLength);
|
||||
links.forEach((link) => expect(link.prop('to')).toContain('abc123'));
|
||||
});
|
||||
|
||||
it('contains a button to delete server', () => {
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import DateInput from '../../src/common/DateInput';
|
||||
import FontAwesomeIcon from '@fortawesome/react-fontawesome';
|
||||
import moment from 'moment';
|
||||
import DateInput from '../../src/common/DateInput';
|
||||
|
||||
describe('<DateInput />', () => {
|
||||
let wrapped;
|
||||
|
||||
const createComponent = (props = {}) => {
|
||||
wrapped = shallow(<DateInput {...props} />);
|
||||
|
||||
return wrapped;
|
||||
};
|
||||
|
||||
afterEach(() => {
|
||||
if (wrapped !== undefined) {
|
||||
wrapped.unmount();
|
||||
|
||||
@@ -2,17 +2,21 @@ import { shallow } from 'enzyme';
|
||||
import { values } from 'ramda';
|
||||
import React from 'react';
|
||||
import * as sinon from 'sinon';
|
||||
import { Home } from '../../src/common/Home';
|
||||
import { HomeComponent } from '../../src/common/Home';
|
||||
|
||||
describe('<Home />', () => {
|
||||
let wrapped;
|
||||
const defaultProps = {
|
||||
resetSelectedServer: () => {},
|
||||
resetSelectedServer() {
|
||||
return '';
|
||||
},
|
||||
servers: {},
|
||||
};
|
||||
const createComponent = props => {
|
||||
const createComponent = (props) => {
|
||||
const actualProps = { ...defaultProps, ...props };
|
||||
wrapped = shallow(<Home {...actualProps} />);
|
||||
|
||||
wrapped = shallow(<HomeComponent {...actualProps} />);
|
||||
|
||||
return wrapped;
|
||||
};
|
||||
|
||||
@@ -42,7 +46,7 @@ describe('<Home />', () => {
|
||||
const servers = {
|
||||
1: { name: 'foo', id: '123' },
|
||||
2: { name: 'bar', id: '456' },
|
||||
}
|
||||
};
|
||||
const wrapped = createComponent({ servers });
|
||||
|
||||
expect(wrapped.find('Link')).toHaveLength(0);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { CreateServer } from '../../src/servers/CreateServer';
|
||||
import { identity } from 'ramda';
|
||||
import sinon from 'sinon';
|
||||
import { CreateServerComponent } from '../../src/servers/CreateServer';
|
||||
import ImportServersBtn from '../../src/servers/helpers/ImportServersBtn';
|
||||
|
||||
describe('<CreateServer />', () => {
|
||||
@@ -17,7 +17,7 @@ describe('<CreateServer />', () => {
|
||||
historyMock.push.resetHistory();
|
||||
|
||||
wrapper = shallow(
|
||||
<CreateServer
|
||||
<CreateServerComponent
|
||||
createServer={createServerMock}
|
||||
resetSelectedServer={identity}
|
||||
history={historyMock}
|
||||
@@ -41,7 +41,10 @@ describe('<CreateServer />', () => {
|
||||
|
||||
it('creates server and redirects to it when form is submitted', () => {
|
||||
const form = wrapper.find('form');
|
||||
form.simulate('submit', { preventDefault: () => {} });
|
||||
|
||||
form.simulate('submit', { preventDefault() {
|
||||
return '';
|
||||
} });
|
||||
|
||||
expect(createServerMock.callCount).toEqual(1);
|
||||
expect(historyMock.push.callCount).toEqual(1);
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import React from 'react';
|
||||
import DeleteServerButton from '../../src/servers/DeleteServerButton';
|
||||
import { shallow } from 'enzyme';
|
||||
import DeleteServerButton from '../../src/servers/DeleteServerButton';
|
||||
import DeleteServerModal from '../../src/servers/DeleteServerModal';
|
||||
|
||||
describe('<DeleteServerButton />', () => {
|
||||
let wrapper;
|
||||
|
||||
beforeEach(() =>
|
||||
wrapper = shallow(<DeleteServerButton server={{}} className="button" />));
|
||||
beforeEach(() => {
|
||||
wrapper = shallow(<DeleteServerButton server={{}} className="button" />);
|
||||
});
|
||||
afterEach(() => wrapper.unmount());
|
||||
|
||||
it('renders a button and a modal', () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { DeleteServerModal } from '../../src/servers/DeleteServerModal';
|
||||
import sinon from 'sinon';
|
||||
import { Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';
|
||||
import { DeleteServerModalComponent } from '../../src/servers/DeleteServerModal';
|
||||
|
||||
describe('<DeleteServerModal />', () => {
|
||||
let wrapper;
|
||||
@@ -17,7 +17,7 @@ describe('<DeleteServerModal />', () => {
|
||||
historyMock.push.resetHistory();
|
||||
|
||||
wrapper = shallow(
|
||||
<DeleteServerModal
|
||||
<DeleteServerModalComponent
|
||||
server={{ name: serverName }}
|
||||
toggle={toggleMock}
|
||||
isOpen={true}
|
||||
@@ -37,6 +37,7 @@ describe('<DeleteServerModal />', () => {
|
||||
|
||||
it('displays the name of the server as part of the content', () => {
|
||||
const modalBody = wrapper.find(ModalBody);
|
||||
|
||||
expect(modalBody.find('p').first().text()).toEqual(
|
||||
`Are you sure you want to delete server ${serverName}?`
|
||||
);
|
||||
@@ -44,6 +45,7 @@ describe('<DeleteServerModal />', () => {
|
||||
|
||||
it('toggles when clicking cancel button', () => {
|
||||
const cancelBtn = wrapper.find('button').first();
|
||||
|
||||
cancelBtn.simulate('click');
|
||||
|
||||
expect(toggleMock.callCount).toEqual(1);
|
||||
@@ -53,6 +55,7 @@ describe('<DeleteServerModal />', () => {
|
||||
|
||||
it('deletes server when clicking accept button', () => {
|
||||
const acceptBtn = wrapper.find('button').last();
|
||||
|
||||
acceptBtn.simulate('click');
|
||||
|
||||
expect(toggleMock.callCount).toEqual(1);
|
||||
|
||||
@@ -1,34 +1,37 @@
|
||||
import { identity } from 'ramda';
|
||||
import { identity, values } from 'ramda';
|
||||
import React from 'react';
|
||||
import { ServersDropdown } from '../../src/servers/ServersDropdown';
|
||||
import { shallow } from 'enzyme';
|
||||
import { DropdownItem, DropdownToggle } from 'reactstrap';
|
||||
import { ServersDropdownComponent } from '../../src/servers/ServersDropdown';
|
||||
|
||||
describe('<ServersDropdown />', () => {
|
||||
let wrapped;
|
||||
const servers = [{ name: 'foo', id: 1 }, { name: 'bar', id: 2 }, { name: 'baz', id: 3 }];
|
||||
const servers = {
|
||||
'1a': { name: 'foo', id: 1 },
|
||||
'2b': { name: 'bar', id: 2 },
|
||||
'3c': { name: 'baz', id: 3 },
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
wrapped = shallow(<ServersDropdown servers={servers} listServers={identity} />);
|
||||
wrapped = shallow(<ServersDropdownComponent servers={servers} listServers={identity} />);
|
||||
});
|
||||
afterEach(() => wrapped.unmount());
|
||||
|
||||
it('contains the list of servers', () =>
|
||||
expect(wrapped.find(DropdownItem).filter('[to]')).toHaveLength(servers.length)
|
||||
);
|
||||
expect(wrapped.find(DropdownItem).filter('[to]')).toHaveLength(values(servers).length));
|
||||
|
||||
it('contains a toggle with proper title', () =>
|
||||
expect(wrapped.find(DropdownToggle)).toHaveLength(1)
|
||||
);
|
||||
expect(wrapped.find(DropdownToggle)).toHaveLength(1));
|
||||
|
||||
it('contains a button to export servers', () => {
|
||||
const items = wrapped.find(DropdownItem);
|
||||
|
||||
expect(items.filter('[divider]')).toHaveLength(1);
|
||||
expect(items.filter('.servers-dropdown__export-item')).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('contains a message when no servers exist yet', () => {
|
||||
wrapped = shallow(<ServersDropdown servers={[]} listServers={identity} />);
|
||||
wrapped = shallow(<ServersDropdownComponent servers={{}} listServers={identity} />);
|
||||
const item = wrapped.find(DropdownItem);
|
||||
|
||||
expect(item).toHaveLength(1);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import { ImportServersBtn } from '../../../src/servers/helpers/ImportServersBtn';
|
||||
import sinon from 'sinon';
|
||||
import { shallow } from 'enzyme';
|
||||
import { UncontrolledTooltip } from 'reactstrap';
|
||||
import { ImportServersBtnComponent } from '../../../src/servers/helpers/ImportServersBtn';
|
||||
|
||||
describe('<ImportServersBtn />', () => {
|
||||
let wrapper;
|
||||
@@ -12,7 +12,7 @@ describe('<ImportServersBtn />', () => {
|
||||
importServersFromFile: sinon.fake.returns(Promise.resolve([])),
|
||||
};
|
||||
const fileRef = {
|
||||
current: { click: sinon.fake() }
|
||||
current: { click: sinon.fake() },
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -22,11 +22,11 @@ describe('<ImportServersBtn />', () => {
|
||||
fileRef.current.click.resetHistory();
|
||||
|
||||
wrapper = shallow(
|
||||
<ImportServersBtn
|
||||
onImport={onImportMock}
|
||||
<ImportServersBtnComponent
|
||||
createServers={createServersMock}
|
||||
serversImporter={serversImporterMock}
|
||||
fileRef={fileRef}
|
||||
onImport={onImportMock}
|
||||
/>
|
||||
);
|
||||
});
|
||||
@@ -40,14 +40,16 @@ describe('<ImportServersBtn />', () => {
|
||||
|
||||
it('triggers click on file ref when button is clicked', () => {
|
||||
const btn = wrapper.find('#importBtn');
|
||||
|
||||
btn.simulate('click');
|
||||
|
||||
expect(fileRef.current.click.callCount).toEqual(1);
|
||||
});
|
||||
|
||||
it('imports servers when file input changes', done => {
|
||||
it('imports servers when file input changes', (done) => {
|
||||
const file = wrapper.find('.create-server__csv-select');
|
||||
file.simulate('change', { target: { files: [''] } });
|
||||
|
||||
file.simulate('change', { target: { files: [ '' ] } });
|
||||
|
||||
setImmediate(() => {
|
||||
expect(serversImporterMock.importServersFromFile.callCount).toEqual(1);
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
import * as sinon from 'sinon';
|
||||
import reduce, {
|
||||
_selectServer,
|
||||
RESET_SELECTED_SERVER,
|
||||
resetSelectedServer,
|
||||
SELECT_SERVER,
|
||||
} from '../../../src/servers/reducers/selectedServer';
|
||||
import * as sinon from 'sinon';
|
||||
import { RESET_SHORT_URL_PARAMS } from '../../../src/short-urls/reducers/shortUrlsListParams';
|
||||
|
||||
describe('selectedServerReducer', () => {
|
||||
describe('reduce', () => {
|
||||
it('returns default when action is not handled', () =>
|
||||
expect(reduce(null, { type: 'unknown' })).toEqual(null)
|
||||
);
|
||||
expect(reduce(null, { type: 'unknown' })).toEqual(null));
|
||||
|
||||
it('returns default when action is RESET_SELECTED_SERVER', () =>
|
||||
expect(reduce(null, { type: RESET_SELECTED_SERVER })).toEqual(null)
|
||||
);
|
||||
expect(reduce(null, { type: RESET_SELECTED_SERVER })).toEqual(null));
|
||||
|
||||
it('returns selected server when action is SELECT_SERVER', () => {
|
||||
const selectedServer = { id: 'abc123' };
|
||||
|
||||
expect(reduce(null, { type: SELECT_SERVER, selectedServer })).toEqual(selectedServer);
|
||||
});
|
||||
});
|
||||
@@ -31,14 +30,14 @@ describe('selectedServerReducer', () => {
|
||||
|
||||
describe('selectServer', () => {
|
||||
const ShlinkApiClientMock = {
|
||||
setConfig: sinon.spy()
|
||||
setConfig: sinon.spy(),
|
||||
};
|
||||
const serverId = 'abc123';
|
||||
const selectedServer = {
|
||||
id: serverId
|
||||
id: serverId,
|
||||
};
|
||||
const ServersServiceMock = {
|
||||
findServerById: sinon.fake.returns(selectedServer)
|
||||
findServerById: sinon.fake.returns(selectedServer),
|
||||
};
|
||||
|
||||
afterEach(() => {
|
||||
@@ -48,14 +47,15 @@ describe('selectedServerReducer', () => {
|
||||
|
||||
it('dispatches proper actions', () => {
|
||||
const dispatch = sinon.spy();
|
||||
const expectedDispatchCalls = 2;
|
||||
|
||||
_selectServer(ShlinkApiClientMock, ServersServiceMock, serverId)(dispatch);
|
||||
|
||||
expect(dispatch.callCount).toEqual(2);
|
||||
expect(dispatch.callCount).toEqual(expectedDispatchCalls);
|
||||
expect(dispatch.firstCall.calledWith({ type: RESET_SHORT_URL_PARAMS })).toEqual(true);
|
||||
expect(dispatch.secondCall.calledWith({
|
||||
type: SELECT_SERVER,
|
||||
selectedServer
|
||||
selectedServer,
|
||||
})).toEqual(true);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import * as sinon from 'sinon';
|
||||
import { values } from 'ramda';
|
||||
import reduce, {
|
||||
_createServer,
|
||||
_deleteServer,
|
||||
@@ -5,13 +7,11 @@ import reduce, {
|
||||
_createServers,
|
||||
FETCH_SERVERS,
|
||||
} from '../../../src/servers/reducers/server';
|
||||
import * as sinon from 'sinon';
|
||||
import { values } from 'ramda';
|
||||
|
||||
describe('serverReducer', () => {
|
||||
const servers = {
|
||||
abc123: { id: 'abc123' },
|
||||
def456: { id: 'def456' }
|
||||
def456: { id: 'def456' },
|
||||
};
|
||||
const ServersServiceMock = {
|
||||
listServers: sinon.fake.returns(servers),
|
||||
@@ -22,12 +22,10 @@ describe('serverReducer', () => {
|
||||
|
||||
describe('reduce', () => {
|
||||
it('returns servers when action is FETCH_SERVERS', () =>
|
||||
expect(reduce({}, { type: FETCH_SERVERS, servers })).toEqual(servers)
|
||||
);
|
||||
expect(reduce({}, { type: FETCH_SERVERS, servers })).toEqual(servers));
|
||||
|
||||
it('returns default when action is unknown', () =>
|
||||
expect(reduce({}, { type: 'unknown' })).toEqual({})
|
||||
);
|
||||
expect(reduce({}, { type: 'unknown' })).toEqual({}));
|
||||
});
|
||||
|
||||
describe('action creators', () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ServersExporter } from '../../../src/servers/services/ServersExporter';
|
||||
import sinon from 'sinon';
|
||||
import { ServersExporter } from '../../../src/servers/services/ServersExporter';
|
||||
|
||||
describe('ServersExporter', () => {
|
||||
const createLinkMock = () => ({
|
||||
@@ -17,7 +17,7 @@ describe('ServersExporter', () => {
|
||||
appendChild: sinon.fake(),
|
||||
removeChild: sinon.fake(),
|
||||
},
|
||||
}
|
||||
},
|
||||
});
|
||||
const serversServiceMock = {
|
||||
listServers: sinon.fake.returns({
|
||||
@@ -41,11 +41,13 @@ describe('ServersExporter', () => {
|
||||
beforeEach(() => {
|
||||
originalConsole = global.console;
|
||||
global.console = { error: sinon.fake() };
|
||||
global.Blob = function Blob() {};
|
||||
global.Blob = class Blob {};
|
||||
global.URL = { createObjectURL: () => '' };
|
||||
serversServiceMock.listServers.resetHistory();
|
||||
});
|
||||
afterEach(() => global.console = originalConsole);
|
||||
afterEach(() => {
|
||||
global.console = originalConsole;
|
||||
});
|
||||
|
||||
it('logs an error if something fails', () => {
|
||||
const csvjsonMock = createCsvjsonMock(true);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ServersImporter } from '../../../src/servers/services/ServersImporter';
|
||||
import sinon from 'sinon';
|
||||
import { ServersImporter } from '../../../src/servers/services/ServersImporter';
|
||||
|
||||
describe('ServersImporter', () => {
|
||||
const servers = [{ name: 'foo' }, { name: 'bar' }];
|
||||
@@ -29,10 +29,13 @@ describe('ServersImporter', () => {
|
||||
|
||||
it('reads file when a CSV is provided', async () => {
|
||||
const readAsText = sinon.fake.returns('');
|
||||
global.FileReader = function FileReader() {
|
||||
this.readAsText = readAsText;
|
||||
this.addEventListener = (eventName, listener) =>
|
||||
listener({ target: { result: '' } });
|
||||
|
||||
global.FileReader = class FileReader {
|
||||
constructor() {
|
||||
this.readAsText = readAsText;
|
||||
this.addEventListener = (eventName, listener) =>
|
||||
listener({ target: { result: '' } });
|
||||
}
|
||||
};
|
||||
|
||||
await importer.importServersFromFile({ type: 'text/csv' });
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { ServersService } from '../../../src/servers/services/ServersService';
|
||||
import sinon from 'sinon';
|
||||
import { last } from 'ramda';
|
||||
import { ServersService } from '../../../src/servers/services/ServersService';
|
||||
|
||||
describe('ServersService', () => {
|
||||
const servers = {
|
||||
abc123: { id: 'abc123' },
|
||||
def456: { id: 'def456' },
|
||||
};
|
||||
const createStorageMock = returnValue => ({
|
||||
const createStorageMock = (returnValue) => ({
|
||||
set: sinon.fake(),
|
||||
get: sinon.fake.returns(returnValue),
|
||||
});
|
||||
|
||||
@@ -9,24 +9,20 @@ describe('shortUrlsListParamsReducer', () => {
|
||||
const defaultState = { page: '1' };
|
||||
|
||||
it('returns default value when action is unknown', () =>
|
||||
expect(reduce(defaultState, { type: 'unknown' })).toEqual(defaultState)
|
||||
);
|
||||
expect(reduce(defaultState, { type: 'unknown' })).toEqual(defaultState));
|
||||
|
||||
it('returns params when action is LIST_SHORT_URLS', () =>
|
||||
expect(reduce(defaultState, { type: LIST_SHORT_URLS, params: { searchTerm: 'foo' } })).toEqual({
|
||||
...defaultState,
|
||||
searchTerm: 'foo'
|
||||
})
|
||||
);
|
||||
searchTerm: 'foo',
|
||||
}));
|
||||
|
||||
it('returns default value when action is RESET_SHORT_URL_PARAMS', () =>
|
||||
expect(reduce(defaultState, { type: RESET_SHORT_URL_PARAMS })).toEqual(defaultState)
|
||||
);
|
||||
expect(reduce(defaultState, { type: RESET_SHORT_URL_PARAMS })).toEqual(defaultState));
|
||||
});
|
||||
|
||||
describe('resetShortUrlParams', () => {
|
||||
it('returns proper action', () =>
|
||||
expect(resetShortUrlParams()).toEqual({ type: RESET_SHORT_URL_PARAMS })
|
||||
);
|
||||
expect(resetShortUrlParams()).toEqual({ type: RESET_SHORT_URL_PARAMS }));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -42,9 +42,9 @@ describe('VisitsParser', () => {
|
||||
describe('processOsStats', () => {
|
||||
it('properly parses OS stats', () => {
|
||||
expect(processOsStats(visits)).toEqual({
|
||||
'Linux': 3,
|
||||
'Windows': 1,
|
||||
'MacOS': 1,
|
||||
Linux: 3,
|
||||
Windows: 1,
|
||||
MacOS: 1,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -52,9 +52,9 @@ describe('VisitsParser', () => {
|
||||
describe('processBrowserStats', () => {
|
||||
it('properly parses browser stats', () => {
|
||||
expect(processBrowserStats(visits)).toEqual({
|
||||
'Firefox': 2,
|
||||
'Chrome': 2,
|
||||
'Opera': 1,
|
||||
Firefox: 2,
|
||||
Chrome: 2,
|
||||
Opera: 1,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user