-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
td.explain does not work on new instance of td.replace('lib') #323
Comments
td.explain currently only supports being passed functions themselves, not objects that reference functions.
… On Jan 17, 2018, at 04:40, Stephan Nordnes Eriksen ***@***.***> wrote:
Info:
It appears that td.explain does not seem to work on new instances (context) of replaced libraries.
Current behaviour:
let td = require('testdouble')
let someLibrary = td.replace('bull') ///Whichever library you want. I Had bull installed, so I tested with that
let instance = new someLibrary()
console.log('instance', instance, td.explain(instance), typeof(instance))
console.log(td.explain(someLibrary))
Running this results in;
$ node weirdness.js
instance testDouble {} { name: undefined,
callCount: 0,
calls: [],
description: 'This is not a test double.',
isTestDouble: false } object
{ name: 'bull: Queue',
callCount: 1,
calls: [ { args: [], context: testDouble {} } ],
description: 'This test double `bull: Queue` has 0 stubbings and 1 invocations.\n\nInvocations:\n - called with `()`.',
isTestDouble: true }
Expected behaviour:
I expected something like the following:
$ node weirdness.js
instance testDouble {} { name: `bull: Queue context`,
callCount: 0,
calls: [],
description: 'This test double `bull: Queue context` has 0 stubbings and 0 invocations.',
isTestDouble: true } object
{ name: 'bull: Queue',
callCount: 1,
calls: [ { args: [], context: testDouble {} } ],
description: 'This test double `bull: Queue` has 0 stubbings and 1 invocations.\n\nInvocations:\n - called with `()`.',
isTestDouble: true }
***@***.***
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Duplicate of #48 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Info:
It appears that
td.explain
does not seem to work on new instances (context) of replaced libraries.Current behaviour:
Running this results in;
Expected behaviour:
I expected something like the following:
testdouble@3.3.2
The text was updated successfully, but these errors were encountered: