Jest: get undefined on import some module

Viewed 2772

I'm making some test to redux with jest but I got sucked because Auth module appears as undefined.

import { auth as Auth } from 'Services/firebase'

export const signIn = (email, password) => {
  console.log(Auth) // It get's undefined
  return dispatch => {
    dispatch(signInInit())
    Auth.signIn(email, password, (user) => {
      dispatch(push('/'))
      return dispatch(signInSuccess(user))
    }, (error) => {
      return dispatch(signInError(error))
    })
  }
}

This is the jest configuration:

"jest": {
    "collectCoverage": true,
    "coverageDirectory": "<rootDir>/coverage",
    "verbose": true,
    "coveragePathIgnorePatterns": [
      "<rootDir>/node_modules"
    ],
    "modulePaths": [
      "<rootDir>/src"
    ],
    "moduleFileExtensions": [
      "js"
    ],
    "moduleDirectories": [
      "node_modules",
      "src"
    ],
    "modulePathIgnorePatterns": [
      "<rootDir>/public"
    ],
    "moduleNameMapper": {
      "\\.(jpg|jpeg|png|gif|eot|otf|svg|ttf|woff|woff2)$": "<rootDir>/src/components/__mocks__/fileTransformer.js",
      "^Components(.*)$": "<rootDir>/src/components",
      "^Data(.*)$": "<rootDir>/src/data",
      "^Hocs(.*)$": "<rootDir>/src/hocs",
      "^Scenes(.*)$": "<rootDir>/src/scenes",
      "^Services(.*)$": "<rootDir>/src/services",
      "^Styles(.*)$": "<rootDir>/src/styles"
}

Really can't understand why this is happening, well any clue will be very welcome.

0 Answers
Related