testutils

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTestConfig

func CreateTestConfig(t *testing.T, content string) string

CreateTestConfig creates a temporary config file for testing

func CreateTestDir

func CreateTestDir(t *testing.T) (string, func())

CreateTestDir creates a temporary directory for testing

func CreateTestRepo added in v0.2.3

func CreateTestRepo(t *testing.T) (string, func())

CreateTestRepo creates a temporary repository for testing

func InitGitRepo

func InitGitRepo(t *testing.T, dir string) error

func RunCommand

func RunCommand(t *testing.T, dir string, name string, args ...string) error

RunCommand executes any command and returns the result

func RunGitCommand

func RunGitCommand(t *testing.T, dir string, args ...string) error

RunGitCommand runs a git command in the specified directory

func StageFile

func StageFile(t *testing.T, dir string, file string) error

func TestConfig

func TestConfig(t *testing.T, content string) (string, func())

TestConfig creates a temporary config file for testing

func TestDir

func TestDir(t *testing.T) (string, func())

TestDir creates a temporary directory for testing

func TestFile

func TestFile(t *testing.T, content string) (string, func())

TestFile creates a temporary file with content for testing

func TestGitRepo

func TestGitRepo(t *testing.T) (string, func())

TestGitRepo creates a temporary git repository for testing

Types

type MockConfigManager

type MockConfigManager struct {
	mock.Mock
}

MockConfigManager is a mock implementation of config.Manager

func (*MockConfigManager) Append

func (m *MockConfigManager) Append(key string, value interface{}) error

func (*MockConfigManager) Get

func (m *MockConfigManager) Get(key string) (interface{}, bool)

func (*MockConfigManager) GetClientConfig added in v0.2.3

func (m *MockConfigManager) GetClientConfig() (*types.ClientConfig, error)

func (*MockConfigManager) GetFileIgnore added in v0.3.0

func (m *MockConfigManager) GetFileIgnore() []string

func (*MockConfigManager) GetNestedValue added in v0.3.0

func (m *MockConfigManager) GetNestedValue(keys []string) (interface{}, bool)

func (*MockConfigManager) GetOutputTranslateTitle added in v0.3.0

func (m *MockConfigManager) GetOutputTranslateTitle() bool

func (*MockConfigManager) GetPath

func (m *MockConfigManager) GetPath() string

func (*MockConfigManager) GetPrompt added in v0.3.0

func (m *MockConfigManager) GetPrompt(rich bool) string

func (*MockConfigManager) GetReviewPrompt added in v0.3.0

func (m *MockConfigManager) GetReviewPrompt() string

func (*MockConfigManager) GetSupportedKeys

func (m *MockConfigManager) GetSupportedKeys() []string

func (*MockConfigManager) GetTranslationPrompt added in v0.3.0

func (m *MockConfigManager) GetTranslationPrompt() string

func (*MockConfigManager) GetWithDefault added in v0.3.0

func (m *MockConfigManager) GetWithDefault(key string, defaultValue interface{}) interface{}

func (*MockConfigManager) List

func (m *MockConfigManager) List() (string, error)

func (*MockConfigManager) ListWithoutPrompt added in v0.3.0

func (m *MockConfigManager) ListWithoutPrompt() map[string]interface{}

func (*MockConfigManager) Load added in v0.3.0

func (m *MockConfigManager) Load() error

func (*MockConfigManager) Remove

func (m *MockConfigManager) Remove(key string, value string) error

func (*MockConfigManager) Reset

func (m *MockConfigManager) Reset(promptOnly bool) error

func (*MockConfigManager) Save added in v0.3.0

func (m *MockConfigManager) Save() error

func (*MockConfigManager) Set

func (m *MockConfigManager) Set(key string, value interface{}) error

func (*MockConfigManager) SetNestedValue added in v0.3.0

func (m *MockConfigManager) SetNestedValue(keys []string, value interface{})

func (*MockConfigManager) UpdateProviderConfig added in v0.3.0

func (m *MockConfigManager) UpdateProviderConfig(provider string, config map[string]string) error

type MockLLM

type MockLLM struct {
	mock.Mock
}

MockLLM is a mock implementation of LLM interface using testify/mock

func (*MockLLM) BuildHeaders

func (m *MockLLM) BuildHeaders() map[string]string

func (*MockLLM) BuildURL

func (m *MockLLM) BuildURL() string

func (*MockLLM) Complete added in v0.2.3

func (m *MockLLM) Complete(message string) (string, error)

func (*MockLLM) FormatMessages

func (m *MockLLM) FormatMessages(message string) (interface{}, error)

func (*MockLLM) GenerateCommitMessage

func (m *MockLLM) GenerateCommitMessage(diff string, prompt string) (string, error)

func (*MockLLM) GetRequiredConfig

func (m *MockLLM) GetRequiredConfig() map[string]config.ConfigRequirement

func (*MockLLM) GetUsage

func (m *MockLLM) GetUsage(data []byte) (string, error)

func (*MockLLM) MakeRequest

func (m *MockLLM) MakeRequest(ctx context.Context, client *http.Client, message string, stream bool) (string, error)

func (*MockLLM) Name

func (m *MockLLM) Name() string

func (*MockLLM) ParseResponse

func (m *MockLLM) ParseResponse(response []byte) (string, error)

func (*MockLLM) TranslateMessage

func (m *MockLLM) TranslateMessage(prompt string, message string, targetLang string) (string, error)

type MockVCS added in v0.2.3

type MockVCS struct {
	mock.Mock
}

MockVCS is a mock implementation of VCS interface

func (*MockVCS) CreateCommit added in v0.2.3

func (m *MockVCS) CreateCommit(repoPath string, message string) error

func (*MockVCS) GetCommitInfo added in v0.2.3

func (m *MockVCS) GetCommitInfo(repoPath string, hash string) (string, error)

func (*MockVCS) GetCurrentBranch added in v0.3.0

func (m *MockVCS) GetCurrentBranch(repoPath string) (string, error)

func (*MockVCS) GetDiff added in v0.2.3

func (m *MockVCS) GetDiff(repoPath string) (string, error)

func (*MockVCS) GetFileContent added in v0.2.3

func (m *MockVCS) GetFileContent(repoPath string, file string) (string, error)

func (*MockVCS) GetLastCommitHash added in v0.2.3

func (m *MockVCS) GetLastCommitHash(repoPath string) (string, error)

func (*MockVCS) GetStagedFiles added in v0.2.3

func (m *MockVCS) GetStagedFiles(repoPath string) ([]string, error)

func (*MockVCS) HasStagedChanges added in v0.2.3

func (m *MockVCS) HasStagedChanges(repoPath string) (bool, error)

Jump to

Keyboard shortcuts

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