hunk.code_window:     "android": "expo start --android",
       "ios": "expo start --ios",
       "web": "expo start --web"
     },
     "dependencies": {
       "expo": "~46.0.0-beta.6",
       "expo-status-bar": "~1.4.0",
       "react": "18.0.0",
  
hunk.labels: keep keep keep keep keep replace keep keep
hunk.after_edit:     "expo": "~46.0.1",
  
hunk.file_path: templates/expo-template-blank/package.json
hunk.type: replace
file: package expo.modules.battery
  
  import android.content.Context
  import android.content.Intent
  import android.os.BatteryManager
  import android.os.PowerManager
  import io.mockk.every
  import io.mockk.mockk
  import expo.modules.core.interfaces.services.EventEmitter
  import org.unimodules.test.core.mockkInternalModule
  
  fun mockContext(): Context {
    return mockk<Context>().also {
      every {
        it.registerReceiver(any(), any())
      } returns Intent()
      every {
        it.applicationContext.registerReceiver(null, any())
      } returns MockBatteryIntent()
      every {
        it.applicationContext.packageName
      } returns "packageName"
    }
  }
  
  fun mockEventEmitter(): MockedEventEmitter {
    return mockkInternalModule<MockedEventEmitter>(asInterface = EventEmitter::class.java).also {
      every {
        it.emit(any() as String, any())
      } returns Unit
    }
  }
  
  fun mockPowerManager(context: Context) {
    every {
      context.applicationContext.getSystemService(Context.POWER_SERVICE)
    } returns mockk<PowerManager>().also {
      every {
        it.isPowerSaveMode
      } returns true
      every {
        it.isIgnoringBatteryOptimizations(any() as String)
      } returns false
    }
  }
  
  class MockBatteryIntent : Intent() {
    override fun getIntExtra(name: String, defaultValue: Int): Int {
      return when (name) {
        BatteryManager.EXTRA_LEVEL -> 50
        BatteryManager.EXTRA_SCALE -> 1
        BatteryManager.EXTRA_STATUS -> BatteryManager.BATTERY_STATUS_FULL
        else -> -1
      }
    }
  }
  