Redux: Copy an Object with Object.assign

I dont know why this isn’t working. When I look at the console.log statements I can see I am not mutating state - but for some reason I get this error:

// running test
Dispatching an action of type ONLINE should update the property status in state to online and should NOT mutate state.
// tests completed

const defaultState = {
  user: 'CamperBot',
  status: 'offline',
  friends: '732,982',
  community: 'freeCodeCamp'

const immutableReducer = (state = defaultState, action) => {
  const newObj = Object.assign({}, state);

  switch(action.type) {
    case 'ONLINE':
      // don't mutate state here or the tests will fail
      newObj.status = action.type;
      console.log(defaultState, newObj)
      return newObj; 
      return state;

const wakeUp = () => {
  return {
    type: 'ONLINE'

const store = Redux.createStore(immutableReducer);

Even if common errors are related to the status mutation, this is not your case:

newObj.status = action.type;

The challenge instruction state

set the status property to the string online

Capitalization matter!
Good luck :slight_smile: