How to use the cozy-device-helper.isMobileApp.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 / Bar.spec.jsx View on Github external
it('should not display searchbar if we are on mobile', () => {
    isMobileApp.mockReturnValue(true)
    const barWrapper = shallow()
    expect(toJson(barWrapper)).toMatchSnapshot()
  })
github cozy / cozy-bar / test / lib / stack-client / stack-client.appiconprops.spec.js View on Github external
beforeAll(() => {
        isMobileApp.mockReturnValue(false)
      })
      it('should have `domain` and `secure` set', () => {
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-bar / test / components / Bar.spec.jsx View on Github external
beforeEach(() => {
    jest.resetAllMocks()
    jest.spyOn(Bar.prototype, 'fetchContent')
    isMobileApp.mockReturnValue(false)
    props = {
      fetchContext: jest.fn().mockResolvedValue({}),
      fetchApps: jest.fn().mockResolvedValue([]),
      fetchSettingsData: jest.fn().mockResolvedValue({}),
      theme: 'default',
      themeOverrides: {},
      t: x => x
    }
  })
github cozy / cozy-ui / react / Popup / index.spec.jsx View on Github external
it('should subcribe to mobile events', () => {
    isMobileApp.mockReturnValue(true)
    const wrapper = shallow()
    expect(popupMock.addEventListener).toHaveBeenCalledWith(
      'loadstart',
      wrapper.instance().handleLoadStart
    )
    expect(popupMock.addEventListener).toHaveBeenCalledWith(
      'exit',
      wrapper.instance().handleClose
    )
  })
github cozy / cozy-ui / react / AppLinker / index.spec.jsx View on Github external
it('should work for native -> web', () => {
    isMobileApp.mockReturnValue(true)
    const root = shallow(
      
    ).dive()
    root.find('a').simulate('click')
    expect(appSwitchMock).toHaveBeenCalled()
  })
github cozy / cozy-ui / react / Popup / index.spec.jsx View on Github external
beforeEach(() => {
    isMobileApp.mockReturnValue(false)
    popupMock.addEventListener = jest.fn()
    popupMock.close = jest.fn()
    popupMock.focus = jest.fn()
    popupMock.closed = false
    props.onClose = jest.fn()
    props.onMessage = jest.fn()
    props.onMobileUrlChange = jest.fn()
  })
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()
  })