Handle nested mocked values
See original GitHub issueAs the title says, when there are nested callable values, I would expect those to be typed as mocked values too.
interface ResourcesApi {
get(id: string): Promise<any>
}
interface Api {
resources: ResourcesApi
}
const api = mock<Api>()
// The next line will get a type error because `get` isn't mocked.
api.resources.get.mockReturnValue(true)
Thoughts?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
mock nested method calls using mockito - java - Stack Overflow
Try by creating mock of each of the nested object and then mock the individual method called by each of these object.
Read more >Mock nested method calls using Mockito in Spring Boot
Mock nested method calls using Mockito in Spring Boot ; 1, Session session = ; 2, connectionFactory.createConnection() ; 3 .createSession(Session.
Read more >Stubbing in nested test classes in combination with ... - GitHub
A workaround I found for some cases like these is defining the mocks with @Mock(answer = org.mockito.Answers.RETURNS_DEEP_STUBS) and not using @ ...
Read more >Deep Mocking | mockzilla
A mocking toolkit leveraging the power of TypeScript to enhance your jest ... You have a deeply nested API, like the browser object...
Read more >Mocking functions declared in nested headers, and union ...
Hi,. I've been using Ceedling for a while, and am now trying to generate CMock mocks for a module that has nested headers....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yep, looking to add support for deep mocks. Will see if I can add support for this without the need for a extra arg
Merged this - currently opt in - will update the readme