import { take , timeout } from "rxjs/operators" ; import { AdvertiseEventData , Snapshot , Uuid } from "../.." ; import { HistorianController } from "../../db" ; export interface AdvertiseEventLogger { count : number ; eventData : AdvertiseEventData [ ] ; } export class MockSnapshotController extends HistorianController { watchForAdvertiseEvents ( logger ) { this . communicationManager . observeAdvertiseWithCoreType ( "Snapshot" ) . subscribe ( event => { logger . count ++ ; logger . eventData . push ( event . data ) ; } ) ; } querySnapshots ( parentObjectId ) { return this . querySnapshotsByParentId ( parentObjectId ) . pipe ( take ( 1 ) , timeout ( this . options [ "queryTimeoutMillis" ] ) ) . toPromise ( ) ; } }