gocron/mocks
Copilot 8187978b01
Add comprehensive GitHub Copilot instructions for gocron development (#866)
* Initial plan

* Initial exploration: identify build, test, and validation patterns

Co-authored-by: JohnRoesler <19351306+JohnRoesler@users.noreply.github.com>

* Add comprehensive GitHub Copilot instructions with validated commands

Co-authored-by: JohnRoesler <19351306+JohnRoesler@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: JohnRoesler <19351306+JohnRoesler@users.noreply.github.com>
2025-08-27 10:56:47 -05:00
..
README.md fix mocks import path (#720) 2024-04-30 09:58:43 -05:00
distributed.go Add comprehensive GitHub Copilot instructions for gocron development (#866) 2025-08-27 10:56:47 -05:00
go.mod fix mocks import path (#720) 2024-04-30 09:58:43 -05:00
go.sum fix mocks import path (#720) 2024-04-30 09:58:43 -05:00
job.go Add comprehensive GitHub Copilot instructions for gocron development (#866) 2025-08-27 10:56:47 -05:00
logger.go Add comprehensive GitHub Copilot instructions for gocron development (#866) 2025-08-27 10:56:47 -05:00
scheduler.go Add comprehensive GitHub Copilot instructions for gocron development (#866) 2025-08-27 10:56:47 -05:00

README.md

gocron mocks

Quick Start

go get github.com/go-co-op/gocron/mocks/v2

write a test

package main

import (
	"testing"

	"github.com/go-co-op/gocron/mocks/v2"
	"github.com/go-co-op/gocron/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)
}