Greenruhm / connect

Greenruhm Connect is your white label, custom-branded connection to the music metaverse. It allows you to provide music NFT services inside your app with your branding.
MIT License
1 stars 0 forks source link

Update logic so `dispatch` logging does not occur when tests are run #66

Closed oliver-day closed 1 year ago

oliver-day commented 1 year ago

Description

When our unit tests dispatch an action those actions are being logged to the console and cluttering the test output:

    Dispatching action:  {} Previous state:  undefined
    New state: {
      user: { email: '', walletAddress: '', sessionToken: '', isSignedIn: false },
      apiKey: { apiKey: null, status: 'Unknown' }
    }
    Dispatching action:  { payload: '<your-api-key>', type: 'apiKey/updateApiKey' } Previous state:  {
      user: { email: '', walletAddress: '', sessionToken: '', isSignedIn: false },
      apiKey: { apiKey: null, status: 'Unknown' }
    }
    New state: {
      user: { email: '', walletAddress: '', sessionToken: '', isSignedIn: false },
      apiKey: { apiKey: '<your-api-key>', status: 'Unknown' }
    }
    Dispatching action:  { payload: '<your-api-key>', type: 'apiKey/updateApiKey' } Previous state:  {
      user: { email: '', walletAddress: '', sessionToken: '', isSignedIn: false },
      apiKey: { apiKey: '<your-api-key>', status: 'Unknown' }
    }
    New state: {
      user: { email: '', walletAddress: '', sessionToken: '', isSignedIn: false },
      apiKey: { apiKey: '<your-api-key>', status: 'Unknown' }
    }

Reference lines 16 and 18 in src/redcuer/store.js:

const dispatch = (action) => {
    console.log('Dispatching action: ', action, 'Previous state: ', state);
    state = reducer(state, action);
    console.log('New state:', state);
  };