Questions tagged [unit-testing]

Unit testing is a method by which individual units of source code are tested to determine if they are fit for use.

0
votes
0answers
19 views

How to mock formControl value getTime() in unit tests

I am trying to unit test a formControl's getTime(). I am getting an error .getTime is not a function. A snippet of the component file looks like: import {FormControl} from @angular/forms; @...
0
votes
1answer
4 views

Unit test: Actions must be plain objects. Use custom middleware for async actions

I know " Actions must be plain objects. Use custom middleware for async actions." has been asked many times, but I can't find the solution. The problem only happens in the enzyme test. This is my ...
0
votes
0answers
10 views

unit test jest __mock__ force different response

i am implementing test with jest using manual __mocks__ I need that the mock file change the response type on each test. This is my current Api that uses axios to make a server calll file ./Api.ts ...
0
votes
0answers
31 views

Unit testing large functions with parameters and interfaces c# [on hold]

I'm trying to write unit tests for the first time in c#. Some of the functions I'm trying to write tests for are pretty big and use interfaces etc I've tried to write some of my own testing but I ...
0
votes
0answers
9 views

Mocking and testing the same data object between python and node

TL;DR: How to mock (for ut) the same object in python and node without code duplication Explanation: In my project architecture we have two servers, one is written in python and the other in node (...
0
votes
1answer
21 views

error method http test with jasmine (angular 7)

I have a simple application in angular 7, which makes a list request of gifs, informing the amount of gifs and the search term, using giphy api. I want to create a test that makes a request, and ...
0
votes
0answers
16 views

Unit Test Repository with Retrofit

I am writing Unit Tests for Repository that makes calls using Retrofit2. I wanted to test logic after receiving Call from server. Problem: when running each test separately all of them pass, but ...
0
votes
0answers
11 views

Python unittest discover at runtime

I'm trying to run my unit tests for a python module from a separate test script. Here is my file structure - root |- modules |- a_module.py |- test |- test_a_module.py |- main.py The ...
0
votes
0answers
18 views

How can I run tests that are not in lib.rs or main.rs? [duplicate]

I am learning to write unit tests in rust. However, I can't get my test running when they are not in src/lib.rs or src/main.rs. I created a project with the following structure: ├── Cargo.lock ├── ...
1
vote
0answers
16 views

Is there a standard way to automate testing of typescript compile-time constructs like mapped-types?

Say we're trying to implement the Pick mapped-type: type Pick<T, K extends keyof T> = { [P in K]: T[P]; }; We should expect that any type built from this conforms to some typescript ...
0
votes
0answers
14 views

CdkDragDrop unit testing events

So, i've been working on unit testing for my Angular app. I'm using Angular Material and i have a component which uses the drag-drop CDK cdk drag-drop API. the html code looks like this <mat-...
0
votes
0answers
46 views

Do I need to implement try/catch expections for testing this method? Not really sure where to start?

I'm unit testing code for an application and I'm confused on how to test try/catch exceptions. What would be a good approach for testing this method? public static Exception Create<TException&...
0
votes
1answer
7 views

How to mock interface properly in Mockito?

For a unit test, I create a mock object via: $passenger = M::mock(PassengerInterface::class); I pass this mock into a service I want to unit test. That service is trying to access a method, which is ...
1
vote
1answer
19 views

How to trigger keyup with enter key

When writing unit tests with ava and vuejs how can I trigger the Enter keyup event? For example, with the following component how can I test that someFunction has been called? <input @keyup....
-1
votes
0answers
6 views

jasmine unit test case for angular 7 bootstrap template reference variable modal pop up

it('should open modal', () => { spyOn(modalService, 'open').and.returnValue(mockModalRef); componentUnderTest.openModal('<xxxx>'); expect(modalService.open).toHaveBeenCalledWith('<xxxx>'...

15 30 50 per page
http://mssss.yulina-kosm.ru