nextcloud/apps/files_sharing/tests/js
Daniel Calviño Sánchez b70b38ce31 Fix constructor spy in unit test with Sinon 4.1.3
When a constructor is spied using Sinon it is wrapped by a proxy
function, which calls the original constructor when invoked. When "new
Foo()" is executed a "Foo" object is created, "Foo" is invoked with the
object as "this", and the object is returned as the result of the whole
"new" expression.

Before Sinon 4.1.3 the proxy called the original constructor directly
using the "thisValue" of the spied call; "thisValue" was the object
created by the "new" operator that called the proxy. The proxy assigned
"thisValue" to "returnValue", so it was also the value returned by the
proxy and, in turn, the value returned by the whole "new" expression.

Since Sinon 4.1.3 (see pull request 1626) the proxy calls the original
constructor using "new" instead of directly. The "thisValue" created by
the outermost "new" (the one that called the proxy) is no longer used by
the original constructor; the internal "new" creates a new object, which
is the one passed to the original constructor and returned by the
internal "new" expression. This object is also the value returned by the
proxy ("returnValue") and, in turn, the value returned by the whole
outermost "new" expression.

Thus, now "returnValue" should be used instead of "thisValue" to get the
object created by the spied constructor.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-12-08 21:26:45 +01:00
..
appSpec.js Added unit tests for right sidebar 2015-08-07 01:22:43 +02:00
fileDropSpec.js deleted forgotten code in test 2017-04-20 22:27:51 +05:45
publicAppSpec.js Fix public link download button 2017-03-20 02:39:46 -06:00
shareSpec.js Fix constructor spy in unit test with Sinon 4.1.3 2017-12-08 21:26:45 +01:00
sharedbreadcrumviewSpec.js Fix AdBlock blocking share icon, ref #866 2017-04-12 15:04:12 +02:00
sharedfilelistSpec.js rip out obsolete recipientsDisplayName 2017-11-23 13:32:14 +01:00