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

import Bugsnag from '../..'

jest.mock('react-native', () => {
  return {
    NativeModules: {
      BugsnagReactNative: {
        configure: () => ({
          apiKey: 'abab1212abab1212abab1212abab1212'
        }),
        resumeSession: () => {},
        addFeatureFlags: jest.fn()
      }
    },
    Platform: {
      OS: 'android'
    }
  }
})

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

describe('react-native notifier: start()', () => {
  it('supports featureFlags', () => {
    Bugsnag.start({
      featureFlags: [
        { name: 'demo_mode' },
        { name: 'sample_group', variant: 'abc123' }
      ]
    })

    expect(NativeModules.BugsnagReactNative.addFeatureFlags).toHaveBeenCalled()
  })
})<commit_msg>add unit test for isStarted<commit_after>// @ts-ignore
import { NativeModules } from 'react-native'

import Bugsnag from '../..'

jest.mock('react-native', () => {
  return {
    NativeModules: {
      BugsnagReactNative: {
        configure: () => ({
          apiKey: 'abab1212abab1212abab1212abab1212'
        }),
        resumeSession: () => {},
        addFeatureFlags: jest.fn()
      }
    },
    Platform: {
      OS: 'android'
    }
  }
})

beforeEach(() => {
  window.fetch = jest.fn()
  window.XMLHttpRequest = jest.fn() as any

  // @ts-ignore:
  Bugsnag._client = null
})

describe('react-native notifier: start()', () => {
  it('supports featureFlags', () => {
    Bugsnag.start({
      featureFlags: [
        { name: 'demo_mode' },
        { name: 'sample_group', variant: 'abc123' }
      ]
    })

    expect(NativeModules.BugsnagReactNative.addFeatureFlags).toHaveBeenCalled()
  })
})

describe('react-native notifier: isStarted', () => {
  it('returns false when the notifier has not been started', () => {
    expect(Bugsnag.isStarted).toBe(false)
  })
  it('returns true when the notifier has been started', () => {
    Bugsnag.start()
    expect(Bugsnag.isStarted).toBe(true)
  })
})
{'fraction_non_alphanumeric': 0.17007797270955166, 'fraction_numerical': 0.018518518518518517, 'mean_word_length': 2.6858168761220824, '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': '126854', 'n_tokens_mistral': 716, 'n_tokens_neox': 697, 'n_words': 116}