Open yigit opened 9 years ago
We should add a test mode where sqlite databases are created memory only.
Database creation could be injected/provided to the JobManager, and an in memory DB could be provided when testing? But I could see a flag being cleaner, depending on what it looks like to enable in memory only sqlite.
@yigit Was the test mode ever implemented? I'm trying to write some unit tests for a migration of jobs from v1 of this library to v2, and being able to do this in test mode would be very helpful.
From @daj on July 24, 2014 22:7
I create a separate instance of the JobManager for each of my automated tests. In the setUp() for each test I set the ID to be a unique String based on System.currentTimeMillis():
Then in my tearDown() I stop and clear the job manager:
Unfortunately I can see that lots of database files are leftover after running my test suite, e.g.
This isn't causing an issue right now as the files are small, but we need a reliable way to remove them. Perhaps .clear() should tidy them up?
In the short term I will probably workaround this by deleting the files in my test tearDown(), e.g.
Copied from original issue: path/android-priority-jobqueue#56