vendredi 22 janvier 2021

Setting the Constraints required by a Worker in an integration test

In my integration test, I enqueue a worker that has constraints battery,

.setRequiresBatteryNotLow(true)

meaning the worker will not doWork() until the constraints are met. Normally, in a unit test one could capture the id of the enqueued worker and use the testDriver to trick the test that all constraints have been met using:

testDriver.setAllConstraintsMet(request.id)

I don't have access to the request since it's created in the black box that I'm integration testing. Is there another way around this? Is it possible to set the testing environment so that my batteryNotLow is "true"?

Aucun commentaire:

Enregistrer un commentaire