nextcloud/apps
Daniel Calviño Sánchez 26cf16d67f
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-11 16:49:39 +01:00
..
admin_audit Don't try to generate logs for chunking paths 2017-06-16 10:42:07 +02:00
comments [tx-robot] updated from transifex 2017-12-10 01:10:38 +00:00
dav [tx-robot] updated from transifex 2017-12-10 01:10:38 +00:00
encryption [tx-robot] updated from transifex 2017-11-12 01:10:15 +00:00
federatedfilesharing [tx-robot] updated from transifex 2017-12-11 01:10:34 +00:00
federation [tx-robot] updated from transifex 2017-12-10 01:10:38 +00:00
files [tx-robot] updated from transifex 2017-12-11 01:10:34 +00:00
files_external Merge pull request #7409 from nextcloud/swift-retry-12 2017-12-08 09:26:41 +01:00
files_sharing Fix constructor spy in unit test with Sinon 4.1.3 2017-12-11 16:49:39 +01:00
files_trashbin [tx-robot] updated from transifex 2017-12-02 01:10:44 +00:00
files_versions [tx-robot] updated from transifex 2017-12-08 01:10:26 +00:00
lookup_server_connector Merge pull request #4783 from nextcloud/lite-application-classes 2017-05-10 17:31:05 -05:00
oauth2 [tx-robot] updated from transifex 2017-12-07 01:10:49 +00:00
provisioning_api throw 101 when an empty group string is provided 2017-09-18 13:10:23 +02:00
sharebymail [tx-robot] updated from transifex 2017-11-20 01:09:53 +00:00
systemtags [tx-robot] updated from transifex 2017-12-11 01:10:34 +00:00
testing Remove unused use statements 2017-04-22 19:23:31 -05:00
theming [tx-robot] updated from transifex 2017-12-07 01:10:49 +00:00
twofactor_backupcodes [tx-robot] updated from transifex 2017-11-12 01:10:15 +00:00
updatenotification [tx-robot] updated from transifex 2017-11-12 01:10:15 +00:00
user_ldap [tx-robot] updated from transifex 2017-12-08 01:10:26 +00:00
workflowengine [tx-robot] updated from transifex 2017-12-10 01:10:38 +00:00