package Ġfi . ri ista . common . helpers Ċ Ċ import Ġcom . squareup . sql de light . sqlite . driver . Jdbc Sqlite Driver Ċ import Ġfi . ri ista . common . database . Database Driver Factory Ċ import Ġfi . ri ista . common . database . Ri ista Database Ċ import Ġkotlinx . coroutines . Coroutine Scope Ċ import Ġkotlinx . coroutines . as Coroutine Dispatcher Ċ import Ġkotlinx . coroutines . run Blocking Ċ import Ġjava . util . concurrent . Executors Ċ import Ġkotlin . coroutines . Coroutine Context ĊĊ Ċ actual Ġval Ġtest Coroutine Context : ĠCor outine Context Ġ= ĊĠĠĠ ĠExec utors . new Single Thread Executor (). as Coroutine Dispatcher () Ċ actual Ġfun Ġrun Blocking Test ( block : Ġsuspend ĠCor outine Scope . () Ġ-> ĠUnit ) Ġ= ĊĠĠĠ Ġrun Blocking ( test Coroutine Context ) Ġ{ Ġthis . block () Ġ} Ċ Ċ actual Ġfun Ġcreate Database Driver Factory (): ĠDatabase Driver Factory Ġ{ ĊĠĠĠ Ġval Ġdriver Ġ= ĠJdbc Sqlite Driver ( Jdbc Sqlite Driver . IN _ MEMORY ). apply Ġ{ ĊĠĠĠĠĠĠĠ ĠRi ista Database . Schema . create ( this ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġdriver . execute ( null , Ġ" PR AG MA Ġforeign _ keys = ON ", Ġ 0 ) ĊĠĠĠ Ġreturn ĠDatabase Driver Factory ( ĊĠĠĠĠĠĠĠ Ġcontext Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġdriver Ġ= Ġdriver , ĊĠĠĠ Ġ) Ċ } Ċ