Category "unit-testing"

Test functions cannot both take a 'done' callback

I'm trying to create a simple test with nestjs, and I'm get this error Test functions cannot both take a 'done' callback and return something. Either use a 'do

test class for handler trigger is not covered

I did a trigger on content version ,but my handler class is not covered ,can you please explain to me why ? please find below the code and screenshots for non c

can we mock method inside object

object Abc { method1(param1,param2):Future[Option[String]] = { //some work } } We are using method1 somewhere and need to stub method1 how can

PYTEST - Is it possible to create the same fixtures more than one time?

I have some parameters coming from a JSON file, and some fixtures in my conftest.py I would like to iterate all the option scenarios from my list and create my

It looks like '' has not been IVY compiled - it has no 'ɵcmp' field

I am currently using Angular 11. When I run the unit tests, all pass except one which says: Error: It looks like 'ResultsService' has not been IVY compiled - it

Identifier "Return" is undefined in gtest?

SPIGtestMain.cpp #include "gtest/gtest.h" #include "gmock/gmock.h" TEST_F(GivenANewSPI,WhenDemoIsCalled_TheComponentGetsVal) { unsigned char const *Ptr;

How to test MassTransit saga state machine with certain state?

I have state machine build with MassTransit: public class OrderStateMachine : MassTransitStateMachine<Order> { public State Completed { get; init; }

Unit Testing - How to build tests around domain entities with lots of encapsulation and many internal states

Admittedly, very new to Unit Testing right now but I'm wanting to make sure I don't end up with a testing project that ends up being a nightmare to maintain. Th

Mock grpc service in unit testing nestjs

I want write an unit test for my getAllGroups() method in mail.service.ts: public async getAllGroup(): Promise<{ id: number, name: string }[]> { try {

Problem with exception handling using Python requests module

The following part of my code is supposed to do exception handling during HTTP requests. app.py class Get: def __init__(self, url): self.url = url

Hypothesis library: strategy for the complement of some other strategy

I'm using the Hypothesis library for unit testing. With this library you don't hand-pick inputs, but you define the complete set of inputs for which you want to

How to jest.mock an ES6 module import?

I've moved a load of helper methods into a npm published library, but some of them are being mocked in the unit tests and I can't figure out how to mock the new

Swift: Unit testing delegate methods with 3rd party class as an argument

I know how to unit test with 3rd party dependencies by extending the class with your own protocol so that you can inject a mock dependency that implements that

How to write test cases for Service layer using Junit 4 and mockito

My Repository layer is returning list object, But in my service layer i am filtering out all other and return a single Object. when i try to create test cases i

Python unit testing with unittest module

This is how I wrote the code to start a test with the unittest module but it is returning as 0 tests. Is the return making any problems? (I am able to share the

Different @QuarkusTestResource per Quarkus profile

I have just set up my project to use H2DatabaseTestResource in the tests. I also have created a custom PostgresDatabaseTestResource, following this brilliant bl

CRA - Jest mock loses the mock implementation

I'm trying to use __mocks__. src/shared/state/use-some-state.ts export const useSomeState = () => { return { value: 6 }; } which is exported from an index

HTTP POST request test is not getting passed

I wrote some nodejs codes to be evaluated by a particular test file, candidate.test.js but surprisingly the test keeps failing. Below is the error I am getting:

ReferenceError: window is not defined, consider using the "jsdom" test environment (jest V28)

I would like some assistance in resolving this error. Am using Jest V28.0.0. Here's how my package.json's test script & devDependencies look like "scri

Nextjs Api unit test - difficult to mock prisma client

I am stuck since long as it is kind of difficult to mock DB calls in unit testing in Nextjs. I have used @prisma/client for database communication. I have studi