Skip to content
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 doesn't work with curry functions. #272

Open
chenyil opened this issue Jun 26, 2017 · 3 comments
Open

td doesn't work with curry functions. #272

chenyil opened this issue Jun 26, 2017 · 3 comments

Comments

@chenyil
Copy link

chenyil commented Jun 26, 2017

I was trying to replace the sinon stub with td, but it didn't work with curry functions. Is it supported by td?

   //in LanguageTranslationHelpersV2
    const deserialize = curry((key, data) => ({
      //some data
    }))

    //in the test

    //sinon works with curry function
    sinon
      .stub(LanguageTranslationHelpersV2, 'deserialize', () => curry(() => ({test: true})))

    //tried to rewrite it with td, didn't work.
    //error: undefined is not an object (evaluating 'fn(a, _b)')
    td.replace(LanguageTranslationHelpersV2, 'deserialize')
    td.when(LanguageTranslationHelpersV2.deserialize(td.matchers.anything(), td.matchers.anything()))
      .thenDo(() => curry(() => ({test: true})))
@searls
Copy link
Member

searls commented Jun 27, 2017

What is defining curry in this case? Sorry, I'm familiar with the concept of currying, but I don't know what curry is in your case. It'd be very helpful if you could put together a published Runkit notebook to reproduce your issue

@chenyil
Copy link
Author

chenyil commented Jun 29, 2017

@searls sorry I forgot to mention, the curry I'm using is from Ramda http://ramdajs.com/docs/#curry

@searls
Copy link
Member

searls commented Jun 29, 2017

That makes more sense. If you'd be able to get your example into runkit for us so we can see it in action, that'd defnitely help (apologies for not looking at it closely otherwise, I have not used ramda)

@jasonkarns jasonkarns added this to Backlog in Test Double Trouble Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants