OK, so lets write a simple first test. We are going to begin with testing a very simple Action creator. If you are not familiar with the difference between Actions and Action creators, read this.

actions.js

Here is an actionsJS file with a single const SET_SELECTED_ACCT and and Action Creator: setSelectedAccount(). This is the Action creator that we will be testing.

actions.js

test.js

This is our test file. We import everything from our actions.js file, set a fake accountNumber to test with and then begin our test. Line 5 and 6 describe our test(you could put multiple it tests inside of a describe), line 8 begins our mocked expected response and line 12 executes our action and uses a toEqual matcher to make the comparison of received vs expected.

Your terminal will output something like the following upon success, if errors there will be context for the failure in the terminal.