OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var sinonHelpers = {}; | |
6 | |
7 sinonHelpers.reset = function() { | |
8 | |
9 /** | 5 /** |
10 * @param {Object} obj | 6 * Casts an |object| to sinon.TestStub verifying that it's really a stub. |
11 * @param {string} method | |
12 * @param {Function=} opt_stubFunction | |
13 * @return {sinon.TestStub} | 7 * @return {sinon.TestStub} |
14 * @suppress {reportUnknownTypes} | |
15 */ | 8 */ |
16 sinon.$setupStub = function(obj, method, opt_stubFunction) { | 9 function $testStub(/** Object */ object) { |
17 sinon.stub(obj, method, opt_stubFunction); | 10 base.debug.assert(object.hasOwnProperty("getCall")); |
18 obj[method].$testStub = /** @type {sinon.TestStub} */ (obj[method]); | 11 return /** @type {sinon.TestStub} */ (object); |
19 return obj[method].$testStub; | |
20 }; | 12 }; |
21 | |
22 }; | |
OLD | NEW |