Commit cec51edc authored by Robert Knight's avatar Robert Knight

Use snake case for action types

This is more conventional in our usage of Redux elsewhere in the app.
parent 4f0dbb9b
...@@ -4,9 +4,9 @@ import { watch } from '../watch'; ...@@ -4,9 +4,9 @@ import { watch } from '../watch';
function counterReducer(state = { a: 0, b: 0 }, action) { function counterReducer(state = { a: 0, b: 0 }, action) {
switch (action.type) { switch (action.type) {
case 'increment-a': case 'INCREMENT_A':
return { ...state, a: state.a + 1 }; return { ...state, a: state.a + 1 };
case 'increment-b': case 'INCREMENT_B':
return { ...state, b: state.b + 1 }; return { ...state, b: state.b + 1 };
default: default:
return state; return state;
...@@ -28,10 +28,10 @@ describe('sidebar/util/watch', () => { ...@@ -28,10 +28,10 @@ describe('sidebar/util/watch', () => {
watch(store.subscribe, () => store.getState().a, callback); watch(store.subscribe, () => store.getState().a, callback);
store.dispatch({ type: 'increment-a' }); store.dispatch({ type: 'INCREMENT_A' });
assert.calledWith(callback, 1, 0); assert.calledWith(callback, 1, 0);
store.dispatch({ type: 'increment-a' }); store.dispatch({ type: 'INCREMENT_A' });
assert.calledWith(callback, 2, 1); assert.calledWith(callback, 2, 1);
}); });
...@@ -40,7 +40,7 @@ describe('sidebar/util/watch', () => { ...@@ -40,7 +40,7 @@ describe('sidebar/util/watch', () => {
const store = counterStore(); const store = counterStore();
watch(store.subscribe, () => store.getState().a, callback); watch(store.subscribe, () => store.getState().a, callback);
store.dispatch({ type: 'increment-b' }); store.dispatch({ type: 'INCREMENT_B' });
assert.notCalled(callback); assert.notCalled(callback);
}); });
...@@ -54,7 +54,7 @@ describe('sidebar/util/watch', () => { ...@@ -54,7 +54,7 @@ describe('sidebar/util/watch', () => {
[() => store.getState().a, () => store.getState().b], [() => store.getState().a, () => store.getState().b],
callback callback
); );
store.dispatch({ type: 'increment-a' }); store.dispatch({ type: 'INCREMENT_A' });
assert.calledWith(callback, [1, 0], [0, 0]); assert.calledWith(callback, [1, 0], [0, 0]);
}); });
...@@ -68,13 +68,13 @@ describe('sidebar/util/watch', () => { ...@@ -68,13 +68,13 @@ describe('sidebar/util/watch', () => {
() => store.getState().a, () => store.getState().a,
callback callback
); );
store.dispatch({ type: 'increment-a' }); store.dispatch({ type: 'INCREMENT_A' });
assert.calledWith(callback, 1, 0); assert.calledWith(callback, 1, 0);
callback.resetHistory(); callback.resetHistory();
unsubscribe(); unsubscribe();
store.dispatch({ type: 'increment-a' }); store.dispatch({ type: 'INCREMENT_A' });
assert.notCalled(callback); assert.notCalled(callback);
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment