Files
2024-05-20 17:16:35 +03:00
..
2024-05-20 17:16:35 +03:00
2024-05-20 17:16:35 +03:00
2024-05-20 17:16:35 +03:00
2024-05-20 17:16:35 +03:00
2024-05-20 17:16:35 +03:00
2024-05-20 17:16:35 +03:00
2024-05-20 17:16:35 +03:00

gocron mocks

Quick Start

go get git.company.lan/gopkg/gocron/mocks/v2

write a test

package main

import (
	"testing"

	"git.company.lan/gopkg/gocron/v2"
	"git.company.lan/gopkg/gocron/mocks/v2"
	"go.uber.org/mock/gomock"
)

func myFunc(s gocron.Scheduler) {
	s.Start()
	_ = s.Shutdown()
}

func TestMyFunc(t *testing.T) {
	ctrl := gomock.NewController(t)
	s := gocronmocks.NewMockScheduler(ctrl)
	s.EXPECT().Start().Times(1)
	s.EXPECT().Shutdown().Times(1).Return(nil)

	myFunc(s)
}