本文整理汇总了TypeScript中mock-fs.restore函数的典型用法代码示例。如果您正苦于以下问题:TypeScript restore函数的具体用法?TypeScript restore怎么用?TypeScript restore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了restore函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should fail output to a nonexistent directory', async () => {
try {
mockFs();
const cr = new HtmlPdf.CreateResult('dGVzdA==');
await cr.toFile('myDir/file.pdf');
expect.fail();
} catch (err) {
expect(err.message).to.contain('no such file or directory');
} finally {
mockFs.restore();
}
});
示例2: a
function a() {
mock({
'path/to/fake/dir': {
'some-file.txt': 'file content here',
'empty-dir': {/** empty directory */}
},
'path/to/some.png': new Buffer([8, 6, 7, 5, 3, 0, 9]),
'some/other/path': {/** another empty directory */}
});
// after a test runs
mock.restore();
}
示例3: it
it('should inline the external html file content', () => {
const sourceText = '@Component({templateUrl: "some-file.html" })';
const d = {
'/path/to/dir': {
'some-file.html': '<div>hello</div>',
'some-file.scss': 'body { color: red; }',
'some-file.ts': sourceText,
},
};
mockFs(d);
const results = inlineTemplate(sourceText, '/path/to/dir/some-file.ts');
expect(results).toEqual(`@Component({template:/*ion-inline-start:"/path/to/dir/some-file.html"*/'<div>hello</div>'/*ion-inline-end:"/path/to/dir/some-file.html"*/ })`);
mockFs.restore();
});
示例4: restoreRealFileSystem
function restoreRealFileSystem() {
mockFs.restore();
}
示例5: afterEach
afterEach(() => {
mockFs.restore();
});
示例6: after
after(function(){
mock.restore();
});