How to use the cozy-device-helper.isMobile.mockReturnValue function in cozy-device-helper

To help you get started, we’ve selected a few cozy-device-helper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cozy / cozy-bar / test / components / AppItem.spec.jsx View on Github external
beforeEach(() => {
    global.__TARGET__ = 'browser'
    spyConsoleError = jest.spyOn(console, 'error')

    isMobileApp.mockReturnValue(false)
    isMobile.mockReturnValue(false)
  })
github cozy / cozy-ui / react / AppLinker / index.spec.jsx View on Github external
it('should work for web -> native for Android (custom schema) ', () => {
    isMobile.mockReturnValue(true)
    isAndroid.mockResolvedValue(true)
    const root = shallow(
      
    ).dive()
    root.find('a').simulate('click', { preventDefault: () => {} })
    expect(openDeeplinkOrRedirect).toHaveBeenCalledWith(
      'cozydrive://',
      expect.any(Function)
    )
    expect(appSwitchMock).toHaveBeenCalled()
  })
github cozy / cozy-ui / react / AppLinker / index.spec.jsx View on Github external
beforeEach(() => {
    isMobileApp.mockReturnValue(false)
    spyConsoleError = jest.spyOn(console, 'error')
    spyConsoleError.mockImplementation(message => {
      if (message.lastIndexOf('Warning: Failed prop type:') === 0) {
        throw new Error(message)
      }
    })
    openNativeFromNativeSpy = jest.spyOn(AppLinker, 'openNativeFromNative')
    isMobileApp.mockReturnValue(false)
    isMobile.mockReturnValue(false)
    isAndroid.mockReturnValue(false)
    appSwitchMock = jest.fn()
  })