FakeTaskRepository

In-memory TaskRepository for use in tests.

No SQLDelight or database required. All data is stored in a mutable list and cleared between tests.

Usage:

val repo = FakeTaskRepository()
repo.insert(TaskRequest(id = "task-1", type = TaskType.OneTime))
assertEquals(1, repo.getPending().size)

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
data class StoredTask(val request: TaskRequest, var status: String = "PENDING", var retryCount: Int = 0)

Functions

Link copied to clipboard
open suspend override fun delete(id: String)
Link copied to clipboard
open suspend override fun getAll(): List<TaskRequest>
Link copied to clipboard
open suspend override fun getById(id: String): TaskRequest?
Link copied to clipboard
open suspend override fun getPending(): List<TaskRequest>
Link copied to clipboard
open suspend override fun insert(task: TaskRequest)
Link copied to clipboard
fun reset()

Clears all stored tasks.

Link copied to clipboard

Returns the stored status for a task ID. For assertion in tests.

Link copied to clipboard
open suspend override fun updateStatus(id: String, status: String, retryCount: Int)