Problem with mocking Google Login / exponent-jest

From the forums:

const { Facebook, Google } = require('expo');
Facebook.logInWithReadPermissionsAsync.mockImplementation(() => new Promise(resolve => resolve({
  type: 'success',
  token: 'foo-token',
})));
Google.logInAsync.mockImplementation(() => new Promise(resolve => resolve({
  type: 'success',
  user: {
    id: 1234,
  },
  accessToken: 'bar-token',
})));
1 Comment

Hi expo people :slightly_smiling_face:
I stumbled upon a problem while mocking Expo Components…
I’m trying to mock the login functions of Facebook and Google. For Facebook everything works fine, but the exact same code for Google produces this error:
TypeError: Google.logInAsync.mockImplementation is not a function.
Maybe I’m doing something wrong? I’m quite new to this mocking thing, so there’s a good chance I didn’t understand the concept correctly.
Does someone have an idea what could be the problem here?
I took quick look at the mocking code in exponent-jest but I didn’t see a reason why these to Components should behave differently…