Extract State Logic to Redux - What is wrong?

I’m trying to solve the https://learn.freecodecamp.org/front-end-libraries/react-and-redux/extract-state-logic-to-redux challenge.

I believe I have fulfilled all the instructions using this code:

const ADD = 'add';
const defaultState = [];

const addMessage = (message) => {
  return {
    type: ADD,

const messageReducer = (state = defaultState, action) => {
  switch (action.type) {
    case 'ADD':
      return [...state, action.message];

      return state;

const store = Redux.createStore(messageReducer);

However, I get these messages:

  • The const ADD should exist and hold a value equal to the string ADD (Which obviously is a false message - the const exists and is OK)
  • Dispatching addMessage against the store should immutably add a new message to the array of messages held in state. (And I beleieve I do this)

Any ideas what might be wrong with my code?
BTW, the help for the challege shows a different code, that passes the test even though it does not obey the instructions.

The test tests for const ADD = 'ADD' while your code defines it as 'add'.

Thank you, sometimes one needs a second pair of eyes to see such mistakes.

Now it works (the second test now magically passed)