mocks

package
v0.12.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutorMock

type ExecutorMock struct {
	// RunFunc mocks the Run method.
	RunFunc func(ctx context.Context, prompt string) executor.Result
	// contains filtered or unexported fields
}

ExecutorMock is a mock implementation of processor.Executor.

func TestSomethingThatUsesExecutor(t *testing.T) {

	// make and configure a mocked processor.Executor
	mockedExecutor := &ExecutorMock{
		RunFunc: func(ctx context.Context, prompt string) executor.Result {
			panic("mock out the Run method")
		},
	}

	// use mockedExecutor in code that requires processor.Executor
	// and then make assertions.

}

func (*ExecutorMock) Run

func (mock *ExecutorMock) Run(ctx context.Context, prompt string) executor.Result

Run calls RunFunc.

func (*ExecutorMock) RunCalls

func (mock *ExecutorMock) RunCalls() []struct {
	Ctx    context.Context
	Prompt string
}

RunCalls gets all the calls that were made to Run. Check the length with:

len(mockedExecutor.RunCalls())

type GitCheckerMock added in v0.9.0

type GitCheckerMock struct {
	// HeadHashFunc mocks the HeadHash method.
	HeadHashFunc func() (string, error)
	// contains filtered or unexported fields
}

GitCheckerMock is a mock implementation of processor.GitChecker.

func TestSomethingThatUsesGitChecker(t *testing.T) {

	// make and configure a mocked processor.GitChecker
	mockedGitChecker := &GitCheckerMock{
		HeadHashFunc: func() (string, error) {
			panic("mock out the HeadHash method")
		},
	}

	// use mockedGitChecker in code that requires processor.GitChecker
	// and then make assertions.

}

func (*GitCheckerMock) HeadHash added in v0.9.0

func (mock *GitCheckerMock) HeadHash() (string, error)

HeadHash calls HeadHashFunc.

func (*GitCheckerMock) HeadHashCalls added in v0.9.0

func (mock *GitCheckerMock) HeadHashCalls() []struct {
}

HeadHashCalls gets all the calls that were made to HeadHash. Check the length with:

len(mockedGitChecker.HeadHashCalls())

type InputCollectorMock added in v0.4.0

type InputCollectorMock struct {
	// AskDraftReviewFunc mocks the AskDraftReview method.
	AskDraftReviewFunc func(ctx context.Context, question string, planContent string) (string, string, error)

	// AskQuestionFunc mocks the AskQuestion method.
	AskQuestionFunc func(ctx context.Context, question string, options []string) (string, error)
	// contains filtered or unexported fields
}

InputCollectorMock is a mock implementation of processor.InputCollector.

func TestSomethingThatUsesInputCollector(t *testing.T) {

	// make and configure a mocked processor.InputCollector
	mockedInputCollector := &InputCollectorMock{
		AskDraftReviewFunc: func(ctx context.Context, question string, planContent string) (string, string, error) {
			panic("mock out the AskDraftReview method")
		},
		AskQuestionFunc: func(ctx context.Context, question string, options []string) (string, error) {
			panic("mock out the AskQuestion method")
		},
	}

	// use mockedInputCollector in code that requires processor.InputCollector
	// and then make assertions.

}

func (*InputCollectorMock) AskDraftReview added in v0.6.0

func (mock *InputCollectorMock) AskDraftReview(ctx context.Context, question string, planContent string) (string, string, error)

AskDraftReview calls AskDraftReviewFunc.

func (*InputCollectorMock) AskDraftReviewCalls added in v0.6.0

func (mock *InputCollectorMock) AskDraftReviewCalls() []struct {
	Ctx         context.Context
	Question    string
	PlanContent string
}

AskDraftReviewCalls gets all the calls that were made to AskDraftReview. Check the length with:

len(mockedInputCollector.AskDraftReviewCalls())

func (*InputCollectorMock) AskQuestion added in v0.4.0

func (mock *InputCollectorMock) AskQuestion(ctx context.Context, question string, options []string) (string, error)

AskQuestion calls AskQuestionFunc.

func (*InputCollectorMock) AskQuestionCalls added in v0.4.0

func (mock *InputCollectorMock) AskQuestionCalls() []struct {
	Ctx      context.Context
	Question string
	Options  []string
}

AskQuestionCalls gets all the calls that were made to AskQuestion. Check the length with:

len(mockedInputCollector.AskQuestionCalls())

type LoggerMock

type LoggerMock struct {
	// LogAnswerFunc mocks the LogAnswer method.
	LogAnswerFunc func(answer string)

	// LogDraftReviewFunc mocks the LogDraftReview method.
	LogDraftReviewFunc func(action string, feedback string)

	// LogQuestionFunc mocks the LogQuestion method.
	LogQuestionFunc func(question string, options []string)

	// PathFunc mocks the Path method.
	PathFunc func() string

	// PrintFunc mocks the Print method.
	PrintFunc func(format string, args ...any)

	// PrintAlignedFunc mocks the PrintAligned method.
	PrintAlignedFunc func(text string)

	// PrintRawFunc mocks the PrintRaw method.
	PrintRawFunc func(format string, args ...any)

	// PrintSectionFunc mocks the PrintSection method.
	PrintSectionFunc func(section status.Section)
	// contains filtered or unexported fields
}

LoggerMock is a mock implementation of processor.Logger.

func TestSomethingThatUsesLogger(t *testing.T) {

	// make and configure a mocked processor.Logger
	mockedLogger := &LoggerMock{
		LogAnswerFunc: func(answer string)  {
			panic("mock out the LogAnswer method")
		},
		LogDraftReviewFunc: func(action string, feedback string)  {
			panic("mock out the LogDraftReview method")
		},
		LogQuestionFunc: func(question string, options []string)  {
			panic("mock out the LogQuestion method")
		},
		PathFunc: func() string {
			panic("mock out the Path method")
		},
		PrintFunc: func(format string, args ...any)  {
			panic("mock out the Print method")
		},
		PrintAlignedFunc: func(text string)  {
			panic("mock out the PrintAligned method")
		},
		PrintRawFunc: func(format string, args ...any)  {
			panic("mock out the PrintRaw method")
		},
		PrintSectionFunc: func(section status.Section)  {
			panic("mock out the PrintSection method")
		},
	}

	// use mockedLogger in code that requires processor.Logger
	// and then make assertions.

}

func (*LoggerMock) LogAnswer added in v0.4.0

func (mock *LoggerMock) LogAnswer(answer string)

LogAnswer calls LogAnswerFunc.

func (*LoggerMock) LogAnswerCalls added in v0.4.0

func (mock *LoggerMock) LogAnswerCalls() []struct {
	Answer string
}

LogAnswerCalls gets all the calls that were made to LogAnswer. Check the length with:

len(mockedLogger.LogAnswerCalls())

func (*LoggerMock) LogDraftReview added in v0.6.0

func (mock *LoggerMock) LogDraftReview(action string, feedback string)

LogDraftReview calls LogDraftReviewFunc.

func (*LoggerMock) LogDraftReviewCalls added in v0.6.0

func (mock *LoggerMock) LogDraftReviewCalls() []struct {
	Action   string
	Feedback string
}

LogDraftReviewCalls gets all the calls that were made to LogDraftReview. Check the length with:

len(mockedLogger.LogDraftReviewCalls())

func (*LoggerMock) LogQuestion added in v0.4.0

func (mock *LoggerMock) LogQuestion(question string, options []string)

LogQuestion calls LogQuestionFunc.

func (*LoggerMock) LogQuestionCalls added in v0.4.0

func (mock *LoggerMock) LogQuestionCalls() []struct {
	Question string
	Options  []string
}

LogQuestionCalls gets all the calls that were made to LogQuestion. Check the length with:

len(mockedLogger.LogQuestionCalls())

func (*LoggerMock) Path

func (mock *LoggerMock) Path() string

Path calls PathFunc.

func (*LoggerMock) PathCalls

func (mock *LoggerMock) PathCalls() []struct {
}

PathCalls gets all the calls that were made to Path. Check the length with:

len(mockedLogger.PathCalls())

func (*LoggerMock) Print

func (mock *LoggerMock) Print(format string, args ...any)

Print calls PrintFunc.

func (*LoggerMock) PrintAligned

func (mock *LoggerMock) PrintAligned(text string)

PrintAligned calls PrintAlignedFunc.

func (*LoggerMock) PrintAlignedCalls

func (mock *LoggerMock) PrintAlignedCalls() []struct {
	Text string
}

PrintAlignedCalls gets all the calls that were made to PrintAligned. Check the length with:

len(mockedLogger.PrintAlignedCalls())

func (*LoggerMock) PrintCalls

func (mock *LoggerMock) PrintCalls() []struct {
	Format string
	Args   []any
}

PrintCalls gets all the calls that were made to Print. Check the length with:

len(mockedLogger.PrintCalls())

func (*LoggerMock) PrintRaw

func (mock *LoggerMock) PrintRaw(format string, args ...any)

PrintRaw calls PrintRawFunc.

func (*LoggerMock) PrintRawCalls

func (mock *LoggerMock) PrintRawCalls() []struct {
	Format string
	Args   []any
}

PrintRawCalls gets all the calls that were made to PrintRaw. Check the length with:

len(mockedLogger.PrintRawCalls())

func (*LoggerMock) PrintSection

func (mock *LoggerMock) PrintSection(section status.Section)

PrintSection calls PrintSectionFunc.

func (*LoggerMock) PrintSectionCalls

func (mock *LoggerMock) PrintSectionCalls() []struct {
	Section status.Section
}

PrintSectionCalls gets all the calls that were made to PrintSection. Check the length with:

len(mockedLogger.PrintSectionCalls())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL