Skip to content

Conversation

@notanengineercom
Copy link
Collaborator

This fixes #86

Either Typescript type inheritance is doing something weird, or we are missing something, but refactoring the promise type to extend BaseMockObjectMixin seems to get it right!

The MockObjectPromise type is only applied when the return type of a method or property is a promise.

As I said in the comment on the issue, we need to add tests for as many types as possible, so we can avoid weird issues like with the boolean

@ffMathy
Copy link
Owner

ffMathy commented Mar 19, 2020

This is an amazing fix! Great work!

@ffMathy ffMathy merged commit b348368 into master Mar 19, 2020
@ffMathy
Copy link
Owner

ffMathy commented Mar 19, 2020

Perhaps we could just add a simple unit test for this scenario?

@abdala
Copy link
Contributor

abdala commented Mar 20, 2020

Very nice @notanengineercom :) The code looks good again. I was not comfortable with my implementation, there was too many conditions.

@ffMathy ffMathy deleted the fix-boolean-type branch March 20, 2020 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't mock method that returns boolean

4 participants