<commit_before>import BugsnagReactNativeStatic, {
  Breadcrumb,
  Client,
  Event,
  NotifiableError,
  OnErrorCallback
} from '..'

// @ts-ignore
import { NativeModules } from 'react-native'

const NativeClient = NativeModules.BugsnagReactNative

jest.mock('react-native', () => ({
  NativeModules: {
    BugsnagReactNative: {
      configure: jest.fn(() => ({
        apiKey: '030bab153e7c2349be364d23b5ae93b5'
      })),
      updateCodeBundleId: jest.fn(),
      resumeSession: jest.fn(),
      leaveBreadcrumb: jest.fn(),
      getPayloadInfo: jest.fn().mockReturnValue({}),
      dispatch: jest.fn().mockResolvedValue(true)
    }
  },
  Platform: {
    OS: 'android'
  },
  NativeEventEmitter: function () {},
  DeviceEventEmitter: { addListener: () => {} }
}))

describe('react native notifier', () => {
  let Bugsnag: typeof BugsnagReactNativeStatic

  beforeEach(() => {
    jest.isolateModules(() => {
      Bugsnag = require('..')
    })

    window.fetch = jest.fn()
    window.XMLHttpRequest = jest.fn() as any
  })

  it('accepts plugins', () => {
    Bugsnag.start({
      plugins: [{
        name: 'foobar',
        load: client => 10
      }]
    })
    expect(Bugsnag.getPlugin('foobar')).toBe(10)
  })<commit_msg>test(react-native): convert tests<commit_after>import BugsnagReactNativeStatic, {
  Breadcrumb,
  Client,
  Event,
  NotifiableError,
  OnErrorCallback
} from '..'

// @ts-ignore
import { NativeModules } from 'react-native'

const NativeClient = NativeModules.BugsnagReactNative

jest.mock('react-native', () => ({
  NativeModules: {
    BugsnagReactNative: {
      configure: jest.fn(() => ({
        apiKey: '030bab153e7c2349be364d23b5ae93b5'
      })),
      updateCodeBundleId: jest.fn(),
      resumeSession: jest.fn(),
      leaveBreadcrumb: jest.fn(),
      getPayloadInfo: jest.fn().mockReturnValue({}),
      dispatch: jest.fn().mockResolvedValue(true)
    }
  },
  Platform: {
    OS: 'android'
  }
}))

describe('react native notifier', () => {
  let Bugsnag: typeof BugsnagReactNativeStatic

  beforeEach(() => {
    jest.isolateModules(() => {
      Bugsnag = require('..')
    })

    window.fetch = jest.fn()
    window.XMLHttpRequest = jest.fn() as any
  })

  it('accepts plugins', () => {
    Bugsnag.start({
      plugins: [{
        name: 'foobar',
        load: client => 10
      }]
    })
    expect(Bugsnag.getPlugin('foobar')).toBe(10)
  })
{'fraction_non_alphanumeric': 0.16145181476846057, 'fraction_numerical': 0.02002503128911139, 'mean_word_length': 3.030252100840336, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4998742', 'n_tokens_mistral': 845, 'n_tokens_neox': 818, 'n_words': 132}