Category "mocking"

provideMockStore with MockBuilder in ng-mocks

How to overrider the selector value in MockBuilder provided with provideMockStore In general with Testbed beforeEach(() => { TestBed.configureTestingModul

Unexpected Jest Errors when Mocking Uppy

I'm attempting to mock the Uppy class from the uppy package in a Jest unit test following guidance from this previously answered question. My failing code is be

Compiling AggregatorV2V3Interface leads to TypeError: Interfaces cannot inherit. interface

SOlidity course: Brownie Fund Me Lesson 6: https://github.com/PatrickAlphaC/brownie_fund_me Compiling AggregatorV2V3Interface leads to TypeError: Interfaces can

JEST: My Isolated module function depends on a function found on the same module. After mocking, it still relies on the original implementation

I have abc.js const a = (a)=>{ return (b(a) + 1) } const b = (num)=>{ return(num + 1) } module.exports = { a, b } When I do my test for

Jest Testing - mockReset does not clear the already set values

I have a lambda which calls an interface. Am trying to mock the functions imported from the interface. In each test case, I have to mock different values. When

Can I mock one function exported from a typescript module that uses ES6 import style

I have been struggling with some specific ES6 importing-style and using with Jest mocking in typescript. It's very specific, so I wrote this example puzzle to

Python patch returning magicmock instead of return value

I have this code import cv2 from src.utilities.binary import message2binary from src.utilities.stegUtils import verify_payload def encode(input_path: any, paylo

Why does jest mock test give me undefined?

I am new to learning jest mocks. I am trying out a very simple test. I have a folder greeter. This folder has a file 'greeter.js' and a subfolder called 'test'.

Fake client behaviour when mocking k8s for testing

I am using the fake clientset to perform some mocking in a k8s cli tool I am creating. Therefore I am creating a Job resource jobs := clientset.BatchV1().Jobs(m

Mocking Bull queues in NestJS

I am trying to test that after sending a request to one of my controllers, the queue pushes a job. Implementation itself works as expected. This is my app.modul

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

How to mock a constructor which is throwing a IOException with mockito-inline?

How can i mock the next lines: Workbook templateWorkBook = null; try { templateWorkBook = new XSSFWorkbook(templateWithoutEvents); } catch (IOException ex){

CRA - window object is undefined - jest/react

I have an issue in my tests that flag up a window variable as undefined. But I don't know where in the setupTests.tsx, I would need to define it. So far the var

NestJS Testing ConfigService works

I am writing an application to handle requests and return predefined responses to allow testing of external REST endpoints by software that cannot have internal

Simplifying AWS SDK GO v2 testing/mocking

Amazon has a super useful article describing how to unit test AWS SDK Go v2. I understand their motivation to depart from the "old" way of unit testing the v1

In Jest, how do I mock a Promise of void?

I'm using Jest and Typescript. I have a async function that returns nothing (void). How do I mock returning void? I tried the below const myMockFn = jest.fn(

Angular Test: Mocking Viewchild projected component and observable property

I have the following code that I can't mock in my unit tests: @ContentChild(CarouselInfoComponent) carouselInfo: CarouselInfoComponent; @ContentChild(Carous

How to mock only one typescript class from a module, but leave other classes/functions as is, using the jest framework

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

How to mock a 'request' node module for testing in jest

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