Closed anuragvaru closed 10 months ago
Hi I am new to golang and want to use unit testing to test the code. so that code->function
func CheckTwoFactor(dbpool *pgxpool.Pool) fiber.Handler{ return func(ctx *fiber.Ctx) error { userId :=ctx.FormValue("id") fmt.Println(userId) userID, _ := strconv.Atoi(userId) User,err:=FindUserByID(dbpool,int64(userID)) if err != nil { log.Fatalf("Error when finding user by ID: %v", err) } fmt.Println(User) if !User.Two_factor{ return ctx.JSON(fiber.Map{ "result":false, }) }else{ return ctx.JSON(fiber.Map{ "result":true, }) } } }
how can i use mock in that can any one please help me to reach it's solutiion
This isn't a support forum. Please start to work on the task by yourself, and then ask your question elsewhere.
Hi I am new to golang and want to use unit testing to test the code. so that code->function
how can i use mock in that can any one please help me to reach it's solutiion