in runtimes/testing/TestFeatures.ts [66:99]
private disposables: (() => void)[] = []
constructor() {
this.chat = stubInterface<Chat>()
this.credentialsProvider = stubInterface<CredentialsProvider>()
this.lsp = stubInterface<
Lsp & { workspace: StubbedInstance<Lsp['workspace']> } & {
extensions: StubbedInstance<Lsp['extensions']>
}
>()
this.lsp.workspace = stubInterface<typeof this.lsp.workspace>()
this.lsp.extensions = stubInterface<typeof this.lsp.extensions>()
this.workspace = stubInterface<Workspace>()
this.logging = stubInterface<Logging>()
this.telemetry = stubInterface<Telemetry>()
this.documents = {}
this.runtime = stubInterface<Runtime>()
this.identityManagement = stubInterface<IdentityManagement>()
this.notification = stubInterface<Notification>()
this.sdkInitializator = Object.assign(
// Default callable function for v3 clients
<T, P>(Ctor: SDKClientConstructorV3<T, P>, current_config: P): T => new Ctor({ ...current_config }),
// Property for v2 clients
{
v2: <T extends Service, P extends ServiceConfigurationOptions>(
Ctor: SDKClientConstructorV2<T, P>,
current_config: P
): T => new Ctor({ ...current_config }),
}
)
this.workspace.getTextDocument.callsFake(async uri => this.documents[uri])
this.workspace.getAllTextDocuments.callsFake(async () => Object.values(this.documents))
this.agent = stubInterface<Agent>()
}