Fix sinon.stub deprecation warnings
Calls to `sinon.stub(obj, 'meth', fn)` are deprecated and therefore replaced by `sinon.stub(obj, 'meth).callsFake(fn)` as instructed by the deprecation warning. This makes the js unit testing output readable again. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
8a1d3c7e87
commit
2317d7bb49
5 changed files with 9 additions and 7 deletions
|
@ -8,6 +8,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* global sinon */
|
||||||
|
|
||||||
describe('OCA.Sharing external tests', function() {
|
describe('OCA.Sharing external tests', function() {
|
||||||
var plugin;
|
var plugin;
|
||||||
var urlQueryStub;
|
var urlQueryStub;
|
||||||
|
@ -24,8 +26,8 @@ describe('OCA.Sharing external tests', function() {
|
||||||
plugin = OCA.Sharing.ExternalShareDialogPlugin;
|
plugin = OCA.Sharing.ExternalShareDialogPlugin;
|
||||||
urlQueryStub = sinon.stub(OC.Util.History, 'parseUrlQuery');
|
urlQueryStub = sinon.stub(OC.Util.History, 'parseUrlQuery');
|
||||||
|
|
||||||
confirmDialogStub = sinon.stub(OC.dialogs, 'confirm', dummyShowDialog);
|
confirmDialogStub = sinon.stub(OC.dialogs, 'confirm').callsFake(dummyShowDialog);
|
||||||
promptDialogStub = sinon.stub(OC.dialogs, 'prompt', dummyShowDialog);
|
promptDialogStub = sinon.stub(OC.dialogs, 'prompt').callsFake(dummyShowDialog);
|
||||||
|
|
||||||
plugin.filesApp = {
|
plugin.filesApp = {
|
||||||
fileList: {
|
fileList: {
|
||||||
|
|
|
@ -2273,7 +2273,7 @@ describe('OCA.Files.FileList tests', function() {
|
||||||
var actionStub = sinon.stub();
|
var actionStub = sinon.stub();
|
||||||
var readyHandler = sinon.stub();
|
var readyHandler = sinon.stub();
|
||||||
var clock = sinon.useFakeTimers();
|
var clock = sinon.useFakeTimers();
|
||||||
var debounceStub = sinon.stub(_, 'debounce', function(callback) {
|
var debounceStub = sinon.stub(_, 'debounce').callsFake(function(callback) {
|
||||||
return function() {
|
return function() {
|
||||||
// defer instead of debounce, to make it work with clock
|
// defer instead of debounce, to make it work with clock
|
||||||
_.defer(callback);
|
_.defer(callback);
|
||||||
|
|
|
@ -15,7 +15,7 @@ describe('OCA.External.Settings tests', function() {
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
clock = sinon.useFakeTimers();
|
clock = sinon.useFakeTimers();
|
||||||
select2Stub = sinon.stub($.fn, 'select2', function(args) {
|
select2Stub = sinon.stub($.fn, 'select2').callsFake(function(args) {
|
||||||
if (args === 'val') {
|
if (args === 'val') {
|
||||||
return select2ApplicableUsers;
|
return select2ApplicableUsers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ describe('jquery.avatar tests', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('with ie8 fix', function() {
|
it('with ie8 fix', function() {
|
||||||
sinon.stub(Math, 'random', function() {
|
sinon.stub(Math, 'random').callsFake(function() {
|
||||||
return 0.5;
|
return 0.5;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global oc_appconfig */
|
/* global oc_appconfig, sinon */
|
||||||
describe('OC.Share.ShareDialogView', function() {
|
describe('OC.Share.ShareDialogView', function() {
|
||||||
var $container;
|
var $container;
|
||||||
var oldAppConfig;
|
var oldAppConfig;
|
||||||
|
@ -90,7 +90,7 @@ describe('OC.Share.ShareDialogView', function() {
|
||||||
linkShare: {isLinkShare: false}
|
linkShare: {isLinkShare: false}
|
||||||
});
|
});
|
||||||
|
|
||||||
autocompleteStub = sinon.stub($.fn, 'autocomplete', function() {
|
autocompleteStub = sinon.stub($.fn, 'autocomplete').callsFake(function() {
|
||||||
// dummy container with the expected attributes
|
// dummy container with the expected attributes
|
||||||
if (!$(this).length) {
|
if (!$(this).length) {
|
||||||
// simulate the real autocomplete that returns
|
// simulate the real autocomplete that returns
|
||||||
|
|
Loading…
Reference in a new issue