我想对这段代码进行单元测试,该代码是使用 Clasp 将 Typescript 转换为 Google App Script 的:
function onLinksInText(text: GoogleAppsScript.Document.Text, onLink: OnLinkCallback) {
const iterator = new TextIterator(text, onLink)
const characters = text.getText();
for (let i = 0; i < characters.length; i++) {
iterator.handle(i, text.getLinkUrl(i));
}
iterator.end()
}
为此,我需要创建一个实例GoogleAppsScript.Document.Text
我怎么做?