{"modulePath":"github.com/GoCodeAlone/workflow","version":"v0.87.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package mock\n\nPackage mock provides common mock implementations for testing\n\n## Types\n\n```go\ntype ApplicationWithReset struct {\n\tmodular.Application\n}\n```\nApplicationWithReset extends the standard application with testing utilities\n\n```go\nfunc NewTestApplication() *ApplicationWithReset\n```\nNewTestApplication creates a new application instance suitable for testing\n\n```go\nfunc (a *ApplicationWithReset) ResetServices()\n```\nResetServices clears any registered services for clean testing\n\n```go\ntype ConfigProvider struct {\n\tConfigData map[string]any\n}\n```\nConfigProvider implements a mock config provider\n\n```go\nfunc NewConfigProvider() *ConfigProvider\n```\nNewConfigProvider creates a new mock config provider with proper env structure\n\n```go\nfunc (m *ConfigProvider) GetConfig() any\n```\nGetConfig implements the ConfigProvider interface\n\n```go\nfunc (m *ConfigProvider) UpdateConfigWithProperEnvStructure() *ConfigProvider\n```\nUpdateConfigWithProperEnvStructure updates the configuration with proper environment structure This method fixes the \"env: env: invalid structure\" error that occurs with golobby config\n\n```go\nfunc (m *ConfigProvider) WithWorkflow(name string, config map[string]any) *ConfigProvider\n```\nWithWorkflow adds a workflow configuration to the mock config\n\n```go\ntype CronScheduler struct {\n\tJobs               []string\n\tExecuteImmediately bool\n}\n```\nCronScheduler is a mock implementation of a cron scheduler\n\n```go\nfunc NewCronScheduler() *CronScheduler\n```\nNewCronScheduler creates a new instance of the mock scheduler\n\n```go\nfunc (c *CronScheduler) AddJob(spec string, job any) error\n```\nAddJob adds a job to the scheduler\n\n```go\nfunc (c *CronScheduler) SetExecuteImmediately(immediate bool)\n```\nSetExecuteImmediately sets whether jobs should execute immediately when added\n\n```go\nfunc (c *CronScheduler) Start(ctx context.Context) error\n```\nStart starts the scheduler\n\n```go\nfunc (c *CronScheduler) Stop(ctx context.Context) error\n```\nStop stops the scheduler\n\n```go\ntype CronSchedulerInterface interface {\n\tName() string\n\tInit() error\n\tStart() error\n\tStop() error\n\tSchedule(jobName, cronSchedule string, jobFunc func())\n}\n```\nCronSchedulerInterface defines the interface that matches the module.CronScheduler allowing us to avoid the direct import of the module package\n\n```go\nfunc GetScheduler() CronSchedulerInterface\n```\nGetScheduler returns a mock scheduler instance that implements the interface\n\n```go\ntype LogLevel int\n```\nLogLevel represents logging severity levels\n\n```go\nconst (\n\t// These are placeholder values - adjust them according to actual requirements\n\tLogDebug LogLevel = iota\n\tLogInfo\n\tLogWarning\n\tLogError\n\tLogFatal\n)\n```\n\n```go\ntype Logger struct {\n\tLogEntries []string\n}\n```\nLogger implements a mock logger\n\n```go\nfunc (m *Logger) Debug(msg string, args ...any)\n```\nDebug implements the Logger interface\n\n```go\nfunc (m *Logger) Error(msg string, args ...any)\n```\nError implements the Logger interface\n\n```go\nfunc (m *Logger) Info(msg string, args ...any)\n```\nInfo implements the Logger interface\n\n```go\nfunc (m *Logger) Warn(msg string, args ...any)\n```\nWarn implements the Logger interface\n\n```go\ntype MockCronScheduler struct {\n\t// contains filtered or unexported fields\n}\n```\nMockCronScheduler is our implementation that can be used in tests\n\n```go\nfunc NewMockCronScheduler(name string) *MockCronScheduler\n```\nNewMockCronScheduler creates a new mock scheduler implementation\n\n```go\nfunc (m *MockCronScheduler) Init() error\n```\nInit initializes the scheduler\n\n```go\nfunc (m *MockCronScheduler) Name() string\n```\nName returns the scheduler name\n\n```go\nfunc (m *MockCronScheduler) RunJob(jobName string) bool\n```\nRunJob executes a scheduled job by name (for testing)\n\n```go\nfunc (m *MockCronScheduler) Schedule(jobName, cronSchedule string, jobFunc func())\n```\nSchedule adds a job to the scheduler\n\n```go\nfunc (m *MockCronScheduler) Start() error\n```\nStart starts the scheduler\n\n```go\nfunc (m *MockCronScheduler) Stop() error\n```\nStop stops the scheduler\n\n```go\ntype TestScheduler struct {\n\tSchedulerName     string // Changed from Name to SchedulerName to avoid conflict\n\tCronExpression    string\n\tJobsAdded         []string\n\tJobFunctions      []any\n\tStarted           bool\n\tStopped           bool\n\tStartError        error\n\tStopError         error\n\tAddJobError       error\n\tInitializerCalled bool\n}\n```\nTestScheduler is a mock implementation for testing schedulers\n\n```go\nfunc NewTestScheduler(name, cronExpression string) *TestScheduler\n```\nNewTestScheduler creates a new test scheduler\n\n```go\nfunc (s *TestScheduler) AddJob(spec string, job any) error\n```\nAddJob adds a job to the scheduler\n\n```go\nfunc (s *TestScheduler) Init(registry map[string]any) error\n```\nInit initializes the scheduler\n\n```go\nfunc (s *TestScheduler) Name() string\n```\nName returns the name of the scheduler\n\n```go\nfunc (s *TestScheduler) Start(ctx context.Context) error\n```\nStart starts the scheduler\n\n```go\nfunc (s *TestScheduler) Stop(ctx context.Context) error\n```\nStop stops the scheduler\n\n","path":"github.com/GoCodeAlone/workflow/mock","name":"mock","synopsis":"Package mock provides common mock implementations for testing","isRedistributable":true}
