Code Explainers

Code explainers tagged #mocking

typescript
import { Test, TestingModule } from '@nestjs/testing';
import { getRepositoryToken } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
 

Unit testing a NestJS service with mocked providers

dependency injection mocking unit testing
Intermediate 7 steps
java
@WebMvcTest(OrderController.class)
class OrderControllerTest {
 
    @Autowired

Slicing the web layer with @WebMvcTest in Spring

testing mocking web-layer
Intermediate 9 steps
java
@WebMvcTest(OrderController.class)
class OrderControllerTest {
 
    @Autowired

Slice testing a controller with @WebMvcTest in Spring

testing mocking http
Intermediate 8 steps