All Questions
Tagged with testing unit-testing
6,644
questions
-1
votes
0
answers
32
views
How to mock a method call which is private and static? [closed]
TestThisMethod is the class and command Store is the method invoked from useCommandStore. I want to mock commandStore which is private and static, when and then of JUnit is not working here.
Class ...
3
votes
2
answers
76
views
Can you test whether a function is actually running Asynchronously?
I'm working on a ASP.NET Web Api project to learn the framework and the testing for it and I was wondering if you could test that Asynchronous methods are actually running Asynchronously (or are they ...
-2
votes
0
answers
46
views
How to test a server action function?
I have a nextjs server action that uses mssql for node to connect with the database.
The following is pizza.actions.ts:
export async function get_pizza_id(pizza_name: string) {
try {
if(!...
1
vote
1
answer
55
views
How to unit test for multipart.Form
I need to write tests for that function:
func Parse(f *multipart.Form) ([]Person, error)
It's important to say, that multipart.Form.Value is not just key:value, thats more complicated json, simple ...
1
vote
1
answer
75
views
TS2305: Module '@angular/core/testing' has no exported member async
I updated angular version from 17 to 18 and because of which some modules are no longer supporter especially in spec.ts files while importing them.
Like async from @angular/core/testing and **...
1
vote
2
answers
38
views
How can I write a test with Xunit that accepts an enum as parameter?
I try to write a test that looks like this:
private static readonly IEnumerable<MyEnumType> ListOfEnumValues = Enum.GetValues(typeof(MyEnumType)).Cast<DocumentType>();
private static ...
0
votes
1
answer
20
views
Can I use built-in Microsoft DI in unit tests for init objects?
in unit tests for init and create the objects I would like to use buit-in Microsoft DI, is it good practice?
0
votes
0
answers
8
views
Testing on Loom testnet
I try to deploy it on Loom testnet: truffle.js test --network loom_testnet
**This is my configtion Loom testnet in config-truffle.js : **
enter image description here
AND THIS IS I GOT THIS ERROR
...
1
vote
0
answers
28
views
Nested ViewChilds in Angular component, unit testing
I have a parent component, where in my template i have button :
<button
actions
data-cy="appointment-creation-calendar"
*ngIf="tabIndex === 1"
[...
-1
votes
0
answers
14
views
Is it wrong to use a node module package directly in unit tests instead of mocking them
I'm using vitest to write some unit tests in my react app, and I've been wondering why we don't just use the node_module packages when necessary directly instead of mocking them?
I have included the ...
-1
votes
0
answers
49
views
Debug doesnt starting when trying to debug dotnet test using neovim and neotest
When I set a breakpoint on the test and try to run it in the debugger, nothing happens, the indicator just blinks as if it is running, and after 450 seconds an error appears that the file could not be ...
1
vote
0
answers
46
views
Test suite failed to run ReferenceError: TextEncoder is not defined
I am trying to test my project using a mock API instead of a real one to save money. However, when I add the following code to my setupTests.js file:
// setupTests.js
import { server } from "./...
0
votes
1
answer
39
views
MockMvc test always returns 200 regardless of JWT authorities
@Test
public void testGetOrders() throws Exception {
mockMvc.perform(get("/admin/api/orders/")
.with(jwt().authorities(new SimpleGrantedAuthority("...
1
vote
1
answer
54
views
How to unit test logic under AG GRID gridApi function forEachNode
Trying to get my unit test coverage for this bit of code:
processUpdates(input) {
let request = [];
this.gridApi.forEachNode(function (node) { // <--- How to mock/spy inside forEachNode
...
0
votes
0
answers
30
views
ABAP detailed log of unit tests
The objective will be to be able to generate a document with a more detailed restitution of the tests carried out than what the framework offers; with input data, result data and an explanatory ...