import { SessionFactoryImpl } from "../src/sessionFactory" ; import { InternalSession } from "../src/session" ; import { Persister } from "../src/persister" ; import { EntityMapping } from "../src/mapping/entityMapping" ; import { MappingRegistry } from "../src/mapping/mappingRegistry" ; import { MockPersister } from "./mockPersister" ; import { Constructor } from "../src/index" ; import { MockMongoClient } from "./driver/mockMongoClient" ; export class MockSessionFactory extends SessionFactoryImpl { constructor ( public mappingRegistry ) { super ( new MockMongoClient ( ) , null , mappingRegistry ) ; } createPersister ( session , mapping ) { return new MockPersister ( session , mapping ) ; } createSession ( ) { return < InternalSession > super . createSession ( ) ; } getPersisterForObject ( session , obj ) { return < MockPersister > session . getPersister ( this . getMappingForObject ( obj ) ) ; } getPersisterForConstructor ( session , ctr ) { return < MockPersister > session . getPersister ( this . getMappingForConstructor ( ctr ) ) ; } }