Add mock service as a class
See original GitHub issueHi! You can add the ability to mock the service as a class. Now you can only mock in the form of an object. Now I can only mock the service in this way:
import {MockService} from "./mocks/mock"
...mock(Service, <Partial<any>>MockService.prototype)
But in this case no static methods are passed.
And I would like the whole class to be mocked.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Mockito: How to test my Service with mocking? - Stack Overflow
How do I test a class that has private methods, fields or inner classes? 2231 · How do you assert that a certain...
Read more >Stubbing and Mocking with Mockito and JUnit - Semaphore CI
Learn how to create true unit tests by mocking all external dependencies in your JUnit classes with the help of Mockito.
Read more >Injecting Mockito Mocks into Spring Beans - Baeldung
In this tutorial, we'll discuss how to use dependency injection to insert Mockito mocks into Spring Beans for unit testing.
Read more >Mocking Entities and Services with PHPUnit and Mocks - Drupal
1. Create the class of service: · 2. Create a new container to associate the class with the service name: · 3. Define...
Read more >MockService - Android Developers
Added in API level 33. Deprecated in API level 33 ... Dismiss Got it. Kotlin |Java. public class MockService extends Object ... A...
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
Thanks for the StackBlitz example… It looks like we uncovered a bug in
provideMock
. It was not properly “skipping” the built-in mocking when using a Value/Class/Type Provider withprovideMock
.I just published a fix (v8.5.2) and updated the official StackBlitz with a new example covering the same scenario you have provided.
With 8.5.2, you should be able to use
provideMock
without issue:Thanks for using Shallow, and thanks for reporting this issue!
Please close this issue if this does resolve your problem.
Thanks!