Updated styles in javascript to fulfill adidas rules

This commit is contained in:
Alejandro Celaya
2018-08-25 23:39:27 +02:00
parent ed0aa68452
commit 6a016d8e6f
70 changed files with 1250 additions and 759 deletions

View File

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