本文整理汇总了TypeScript中Sinon.SinonSpy.restore方法的典型用法代码示例。如果您正苦于以下问题:TypeScript SinonSpy.restore方法的具体用法?TypeScript SinonSpy.restore怎么用?TypeScript SinonSpy.restore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sinon.SinonSpy
的用法示例。
在下文中一共展示了SinonSpy.restore方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: cleanSpy
export function cleanSpy(spy: SinonSpy) {
if (spy) {
if (spy.restore) {
spy.restore();
}
spy.reset();
}
}
示例2: afterEach
afterEach(() => {
parseIntSpy.restore();
});
示例3: afterEach
afterEach(() => {
routerSetPathSpy.restore();
});
示例4: stub
run = stub(grunt.task, 'run');
write = spy(grunt.file, 'write');
expandMapping = stub(grunt.file, 'expandMapping', (patterns: string[], base: string) => {
return [ 'foo' ];
});
readJSON = stub(grunt.file, 'readJSON', (filename: string) => {
return {};
});
publisher.commit.returns(true);
prepareOutputDirectory();
},
teardown() {
loadNpmTasks.restore();
write.restore();
run.restore();
readJSON.restore();
expandMapping.restore();
unloadTasks();
cleanOutputDirectory();
process.env.DEPLOY_DOCS = '';
},
beforeEach() {
grunt.initConfig({
apiDocDirectory,
apiPubDirectory,
tsconfig: {
示例5: registerSuite
import * as fs from 'fs';
import { AmdRootRequire } from '../../src/interfaces';
declare const require: AmdRootRequire;
const basePath = '_build/tests/support/data/';
let fsSpy: SinonSpy;
registerSuite('text - node', {
load: {
beforeEach() {
fsSpy = spy(fs, 'readFile');
},
afterEach() {
fsSpy.restore && fsSpy.restore();
},
tests: {
'should return text and call fs'(this: any) {
text.load(
basePath + 'textLoad.txt',
require,
this.async().callback((val: string) => {
assert.isTrue(fsSpy.calledOnce, 'Read file should be called once');
assert.strictEqual(val, 'test', 'Correct text should be returned');
})
);
},
'should return text from cache'(this: any) {
text.load(
示例6: afterEach
afterEach(() => { consoleLog.restore(); })
示例7: afterEach
afterEach(() => {
spy_defaultHandler.restore();
});
示例8: afterEach
afterEach(() => {
normalizeSpy.restore();
updateSpy.restore();
});