I'm trying to test our DataStudio
code (in Typescript), which uses certain Interfaces from the google-apps-script libraries, e.g. the Logger
and DataStudio
Interfaces. These reside in .d.ts
files, so I can't easily import them. This is how Logger
is defined in the google-apps-script.base.d.ts
file:
/// <reference path="google-apps-script.types.d.ts" />
declare namespace GoogleAppsScript {
export module Base {
[...]
export interface Logger {
clear(): void;
getLog(): string;
log(data: Object): Logger;
log(format: string, ...values: Object[]): Logger;
}
}
}
declare var Logger: GoogleAppsScript.Base.Logger;
I'm running jest tests on functions which use these interfaces, but I'm receiving e.g. Logger is not defined
, so I need to somehow mock these Interfaces.
Does anyone know how I can import these interfaces so I can mock them? Thanks for any help!