I have a typescript module with a function that I'm trying to test with jest. The function I'm trying to test uses a typescript class that's defined in the same
I am new to writing test cases in jest and i wanted to test 'mark' function and want to mock 'request' node module. let's say this file's name is app.js and tes
we want to write unit-test for servicebus message trigger. we are using Azure.Messaging.ServiceBus nuget package [FunctionName("serviebustrigger")] publi
i have an app that's using the @slack/web-api package through the named import WebClient. i want to test one of the controllers that uses a model that in turns
Changed the titel to a more common one. I guess the problem is not that class specific. I want to mock google.cloud.pubsub_v1.SubscriberClient I want to set a f
I have the following method I wish to unit test: public class Board { public static BoardElement RandomElement(List<BoardElement> elements) {
Question is exactly same here in fact but has different context: How to mock not installed npm package in jest? I am part of a project where new Module Federati
I wrote a smart contract that uses openzepplin ERC20 standard. I am able to deploy it using truffle and my tests work as expected. I am now trying to test part
I was writing some unit test in python and needed to mock a very general collections.abc.Sized, so I set off creating a Mock with a __len__ method whose return
The second expect(fs.writeFile).toHaveBeenCalledTimes(1) (in describe('Guid for MPX') returns an error because the writeFile has been called twice. In theory, j
I have an API built with Adonis 5 (core version 5.4.0). The tests are made with Adonis' own runner, japa (version 3.1.1). As per the Adonis documentation, I bui
I am trying to generate mock data with Mockaroo and need a simple data type that is unfortunately not inside Mockaroo's built in available data. It is very simp
I'm not sure if my design is simply stupid, or there's a good way to make it work. Consider the following classes: public abstract class CheckBase { protect
I have the following classes class FileDownloader { public static void downloadFile(String repoUrl, String filename) throws IOException { // Downloa
How to mock a specific instance of a class using patch? In my test file I have: @classmethod def setUpClass(cls): cls.instance_of_my_class = myClass() one
Have this abstract class to get data from remote data source abstract class NumberTriviaRemoteDataSource { /// Calls the http://numberapi.com/{number} endpoin
Input: We have API-A and API-B. API-A sends some requests to API-B and do some work with received data. We have unit tests that verify work of methods that doin
I'm unittesting a function that transforms an element from an S3 object into a pandas DataFrame and need to mock the returned StreamingBody object from boto3 f
I have to test the routes of a controller which uses Guzzle Wrapper as a client to get data from an API. The app uses Laravel as a framework. This is the part o
My class, Foo, has a calculate method that takes no parameters, makes a call to a database and does some calculations using class attributes, and sets another c