This commit is contained in:
Kai Moseley 2017-08-07 08:27:17 +01:00
parent cf0ed297a2
commit 3afd314f5a
4 changed files with 8 additions and 8 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "redux-scc",
"version": "1.0.1",
"version": "1.1.0",
"lockfileVersion": 1,
"dependencies": {
"abab": {

View File

@ -1,6 +1,6 @@
{
"name": "redux-scc",
"version": "1.0.1",
"version": "1.1.0",
"description": "Redux store chunk creator",
"main": "./lib/index.js",
"scripts": {

View File

@ -3,7 +3,7 @@ import {
getApplicableCombinedActions,
createCombinedAction,
isCombinedAction,
BATCH_UPDATE,
COMBINED_ACTION,
} from '../batchUpdates';
@ -28,7 +28,7 @@ describe('getApplicableCombinedActions', () => {
describe('isCombinedAction', () => {
it('should return true if action contains batch action string', () => {
expect(isCombinedAction(`Boop!${ BATCH_UPDATE }`)).toBe(true);
expect(isCombinedAction(`Boop!${ COMBINED_ACTION }`)).toBe(true);
});
@ -48,7 +48,7 @@ describe('createCombinedAction action', () => {
it('should return an action with a type including the batch update string and name', () => {
expect(createCombinedAction({
name: 'boop!'
}).type).toMatch(new RegExp(`${ BATCH_UPDATE }`));
}).type).toMatch(new RegExp(`${ COMBINED_ACTION }`));
});

View File

@ -3,7 +3,7 @@ import keys from 'lodash/fp/keys';
import includes from 'lodash/fp/includes';
import filter from 'lodash/fp/filter';
export const BATCH_UPDATE = '(redux-scc-batch-action)';
export const COMBINED_ACTION = '/@@redux-scc-combined-action';
type BatchUpdateInterface = {
@ -22,13 +22,13 @@ export const createCombinedAction = ({
name = '',
actions,
}: BatchUpdateInterface) => ({
type: `${ name }${ BATCH_UPDATE }`,
type: `${ name }${ COMBINED_ACTION }`,
payload: actions,
});
export const isCombinedAction = (actionType: string) => actionType
? actionType.indexOf(BATCH_UPDATE) > -1
? actionType.indexOf(COMBINED_ACTION) > -1
: false;