import * as mongodb from "mongodb" ; import { Readable } from "stream" ; import { IteratorCallback } from "mongodb" ; import { EndCallback } from "mongodb" ; export class MockCursor extends Readable implements mongodb . Cursor { private _closed = false ; private _sorting : any [ ] ; sortValue : string ; projectValue : Object ; timeout : boolean ; readPreference : mongodb . ReadPreference ; constructor ( public contents = [ ] ) { super ( ) ; } addCursorFlag ( flag , value ) { throw new Error ( "Method not implemented." ) ; } addQueryModifier ( name , value ) { throw new Error ( "Method not implemented." ) ; } batchSize ( value ) { return this ; } clone ( ) { throw new Error ( "Method not implemented." ) ; } close ( ) ; close ( callback ) ; close ( callback ? ) { this . _closed = true ; } comment ( value ) { throw new Error ( "Method not implemented." ) ; } count ( callback ) ; count ( applySkipLimit , callback ) ; count ( options , callback ) ; count ( applySkipLimit , options , callback ) ; count ( applySkipLimit ? , options ? ) ; count ( applySkipLimit ? , options ? , callback ? ) { throw new Error ( "Method not implemented." ) ; } explain ( ) ; explain ( callback ) ; explain ( callback ? ) { throw new Error ( "Method not implemented." ) ; } filter ( filter ) { return this ; } forEach < T > ( iterator , callback ) ; forEach < T > ( iterator ) ; forEach < T > ( iterator , callback ? ) { throw new Error ( "Method not implemented." ) ; } hasNext ( ) ; hasNext ( callback ) ; hasNext ( callback ? ) { throw new Error ( "Method not implemented." ) ; } hint ( hint ) { throw new Error ( "Method not implemented." ) ; } isClosed ( ) { return this . _closed ; } limit ( value ) { return this ; } map ( transform ) { throw new Error ( "Method not implemented." ) ; } max ( max ) { throw new Error ( "Method not implemented." ) ; } maxAwaitTimeMS ( value ) { throw new Error ( "Method not implemented." ) ; } maxScan ( maxScan ) { throw new Error ( "Method not implemented." ) ; } maxTimeMS ( value ) { throw new Error ( "Method not implemented." ) ; } collation ( value ) { throw new Error ( "Method not implemented." ) ; } min ( min ) { throw new Error ( "Method not implemented." ) ; } next ( ) ; next ( callback ) ; next ( callback ? ) { callback ( ) ; } project ( value ) { this . projectValue = value ; return this ; } read ( size ) { throw new Error ( "Method not implemented." ) ; } returnKey ( returnKey ) { throw new Error ( "Method not implemented." ) ; } rewind ( ) { throw new Error ( "Method not implemented." ) ; } setCursorOption ( field , value ) { throw new Error ( "Method not implemented." ) ; } setReadPreference ( readPreference ) { return this ; } showRecordId ( showRecordId ) { throw new Error ( "Method not implemented." ) ; } skip ( value ) { return this ; } snapshot ( snapshot ) { throw new Error ( "Method not implemented." ) ; } sort ( keyOrList , direction ? ) { if ( this . onSort ) { return this . onSort ( keyOrList , direction ) ; } return this ; } onSort : ( keyOrList : any , directionOrCallback : any ) => mongodb . Cursor ; stream ( options ? ) { throw new Error ( "Method not implemented." ) ; } toArray ( ) ; toArray ( callback ) ; toArray ( callback ? ) { process . nextTick ( ( ) => { callback ( null , this . contents ) ; } ) ; } unshift ( stream ) { throw new Error ( "Method not implemented." ) ; } }