license export interface PrerunCallback { ( ) : void ; } export interface Module { __memory : ArrayBuffer | null ; HEAPU8 : Uint8Array ; HEAPU32 : Uint32Array ; HEAPF32 : Float32Array ; HEAPF64 : Float64Array ; preRun : PrerunCallback [ ] ; _malloc ( size ) : number | null ; _free ( ptr ) : void ; _addObjectIndexWithId ( objectId , size , indexPtr ) : void ; _cancelObjectId ( objectId ) : void ; process ( ptr ) : { size ( ) : number ; get ( ) : { id : number ; } ; } ; } declare global { interface Window { Module : Module ; } } export class ModuleMock implements Module { preRun : PrerunCallback [ ] = [ ] ; private memory ! : ArrayBuffer | null ; constructor ( public invalidMalloc = false , public mallocOffset = 0 ) { } _malloc ( size ) { if ( this . invalidMalloc ) { return null ; } this . memory = new ArrayBuffer ( this . mallocOffset + size ) ; return this . mallocOffset ; } get HEAPU8 ( ) { return new Uint8Array ( this . memory ! ) ; } get HEAPU32 ( ) { return new Uint32Array ( this . memory ! ) ; } get HEAPF32 ( ) { return new Float32Array ( this . memory ! ) ; } get HEAPF64 ( ) { return new Float64Array ( this . memory ! ) ; } get __memory ( ) : ArrayBuffer | null { return this . memory ; } _free ( _ ) { this . memory = null ; } _addObjectIndexWithId ( objectId , size , indexPtr ) { } _cancelObjectId ( objectId ) { } process ( _ ) { return { get : ( ) => ( { id : 1 } ) , size : ( ) => 1 , } ; } }