本文整理汇总了TypeScript中@es-git/object-mixin.textToBlob函数的典型用法代码示例。如果您正苦于以下问题:TypeScript textToBlob函数的具体用法?TypeScript textToBlob怎么用?TypeScript textToBlob使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了textToBlob函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('load expected type', async t => {
const load = sinon.stub();
load.resolves({
type: Type.blob,
body: textToBlob('text')
});
const objectRepo = new LoadAsRepo({load});
const result = await objectRepo.loadBlob('blabla');
t.deepEqual(result, textToBlob('text'));
});
示例2: test
test('save text', async t => {
const save = sinon.spy();
const objectRepo = new SaveAsRepo({save});
const result = await objectRepo.saveText('hello');
t.true(save.calledOnce);
t.deepEqual(save.args[0][0], {
type: Type.blob,
body: textToBlob('hello')
});
});
示例3: saveText
async saveText(text : string){
return await super.saveObject({
type: Type.blob,
body: textToBlob(text)
});
}