This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// testEntireState.js | |
var tape = require('tape') | |
var redux = require('redux') | |
var reducer = require('./reducer') | |
// --------------------------------------------------- | |
// Tape test starts here... | |
tape('Increment counter along with a status message', function (test) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// testValueInState.js | |
var tape = require('tape') | |
var redux = require('redux') | |
var reducer = require('./reducer') | |
// --------------------------------------------------- | |
// Tape test starts here... | |
tape('Increment counter', function (test) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// reducer.js | |
module.exports = function reducer (state, action) { | |
switch (action.type) { | |
// action that increments a counter | |
case 'INCREMENT': { | |
// clone a fresh copy of our current state, as reducers never mutate existing state | |
var newState = Object.assign({}, state) | |
// increment the counter in state |