import { GitManager } from "@fluidframework/server-services-client" ; import { ITenant , ITenantManager , ITenantOrderer , ITenantStorage , IDb , ITenantConfig , } from "@fluidframework/server-services-core" ; import { TestHistorian } from "./testHistorian" ; import { TestDb } from "./testCollection" ; export class TestTenant implements ITenant { private readonly owner = "test" ; private readonly repository = "test" ; private readonly manager : GitManager ; constructor ( private readonly url , private readonly historianUrl , db ) { const testHistorian = new TestHistorian ( db ) ; this . manager = new GitManager ( testHistorian ) ; } public get gitManager ( ) : GitManager { return this . manager ; } public get storage ( ) : ITenantStorage { return { historianUrl : this . historianUrl , internalHistorianUrl : this . historianUrl , credentials : null , owner : this . owner , repository : this . repository , url : this . url } ; } public get orderer ( ) : ITenantOrderer { return { type : "kafka" , url : this . url } ; } } export class TestTenantManager implements ITenantManager { private readonly tenant : TestTenant ; constructor ( url = "http://test" , historian = "http://historian" , testDb = new TestDb ( { } ) ) { this . tenant = new TestTenant ( url , historian , testDb ) ; } public createTenant ( id ? ) { return Promise . resolve ( { id : "test-tenant" , storage : this . tenant . storage , orderer : this . tenant . orderer , key : "test-tenant-key" , customData : { } } ) ; } public verifyToken ( token ) { return Promise . resolve ( ) ; } public getTenant ( id ) { return Promise . resolve ( this . tenant ) ; } public getKey ( tenantId ) { return Promise . resolve ( "test" ) ; } }