import { EMPTY , Subscribable } from 'rxjs' ; import { Thunk } from '../../../core/createApp/createApp.h' ; private export async function collectData < T > ( stream = EMPTY ) { const result = [ ] ; return new Promise ( ( res , rej ) => stream . subscribe ( { next : ( x ) => result . push ( x ) , complete : res , error : rej } ) ) . then ( ( ) => result ) ; } private export async function collectThunkData ( thunk , state ? ) { const dispatch = jest . fn ( ) ; await thunk ( ( ) => state , dispatch ) ; return dispatch . mock . calls . map ( ( call ) => call [ 0 ] ) ; }