Documentation
¶
Index ¶
- Variables
- func AssertTaskDatesSet(t *testing.T, task *models.Task)
- func AssertTaskHasUUID(t *testing.T, task *models.Task)
- func CreateMockMovieSearchResults() []services.Media
- func CreateMockTVSearchResults() []services.Media
- func CreateTestMovieService(mockFetcher *MockMediaFetcher) *services.MovieService
- func CreateTestTVService(mockFetcher *MockMediaFetcher) *services.TVService
- func ListMediaItems[T any](ctx context.Context, status string, mediaType string, ...) error
- func MockOpenLibraryResponse(books []MockBook) services.OpenLibrarySearchResponse
- func MockRottenTomatoesResponse(movies []MockMedia) string
- func ParseID(id string, itemType string) (int64, error)
- func PrintSearchResults[T models.Model](results []*models.Model, formatter func(*models.Model, int)) error
- func PromptUserChoice(reader io.Reader, maxChoices int) (int, error)
- func Reset(ctx context.Context, args []string) error
- func RunTUIScenarios(t *testing.T, suite *ui.TUITestSuite, scenarios []TUITestScenario)
- func Setup(ctx context.Context, args []string) error
- func SetupHandlerTest(t *testing.T) (string, func())
- func Status(ctx context.Context, args []string, w io.Writer) error
- func TestBookInteractiveList(t *testing.T, handler *BookHandler, status string) error
- func TestMovieInteractiveList(t *testing.T, handler *MovieHandler, status string) error
- func TestNoteInteractiveList(t *testing.T, handler *NoteHandler, showArchived bool, tags []string) error
- func TestTVInteractiveList(t *testing.T, handler *TVHandler, status string) error
- func TestTaskInteractiveList(t *testing.T, handler *TaskHandler, showAll bool, ...) error
- type ArticleHandler
- func (h *ArticleHandler) Add(ctx context.Context, url string) error
- func (h *ArticleHandler) Close() error
- func (h *ArticleHandler) Help() error
- func (h *ArticleHandler) List(ctx context.Context, query string, author string, limit int) error
- func (h *ArticleHandler) Read(ctx context.Context, id int64) error
- func (h *ArticleHandler) Remove(ctx context.Context, id int64) error
- func (h *ArticleHandler) View(ctx context.Context, id int64) error
- type ArticleTestHelper
- type AssertionHelpers
- func (ah AssertionHelpers) AssertArticleExists(t *testing.T, handler *ArticleTestHelper, id int64)
- func (ah AssertionHelpers) AssertArticleNotExists(t *testing.T, handler *ArticleTestHelper, id int64)
- func (ah AssertionHelpers) AssertError(t *testing.T, err error, expectedSubstring string, msg string)
- func (ah AssertionHelpers) AssertNoError(t *testing.T, err error, msg string)
- func (ah AssertionHelpers) AssertNoteExists(t *testing.T, handler *HandlerTestHelper, id int64)
- func (ah AssertionHelpers) AssertNoteNotExists(t *testing.T, handler *HandlerTestHelper, id int64)
- type BookHandler
- func (h *BookHandler) Close() error
- func (h *BookHandler) List(ctx context.Context, status string) error
- func (h *BookHandler) Remove(ctx context.Context, id string) error
- func (h *BookHandler) SearchAndAdd(ctx context.Context, query string, interactive bool) error
- func (h *BookHandler) SetInputReader(reader io.Reader)
- func (h *BookHandler) UpdateProgress(ctx context.Context, id string, progress int) error
- func (h *BookHandler) UpdateStatus(ctx context.Context, id, status string) error
- type ConfigHandler
- type DatabaseTestHelper
- type EnvironmentTestHelper
- type HTTPMockServer
- func EmptyResponseMockServer() *HTTPMockServer
- func HTTPErrorMockServer(statusCode int, message string) *HTTPMockServer
- func InvalidJSONMockServer() *HTTPMockServer
- func JSONMockServer(response any) *HTTPMockServer
- func NewMockServer() *HTTPMockServer
- func TimeoutMockServer(delay time.Duration) *HTTPMockServer
- type HandlerTestHelper
- type InputSimulator
- type InteractiveTUIHelper
- func (ith *InteractiveTUIHelper) StartTUITest(ctx context.Context) (*ui.TUITestSuite, error)
- func (ith *InteractiveTUIHelper) TestInteractiveList(ctx context.Context, testFunc func(*ui.TUITestSuite) error) error
- func (ith *InteractiveTUIHelper) TestInteractiveNavigation(ctx context.Context, keySequence []tea.KeyType) error
- func (ith *InteractiveTUIHelper) TestInteractiveSelection(ctx context.Context, selected int, action tea.KeyType) error
- func (ith *InteractiveTUIHelper) WithMockData(data any) *InteractiveTUIHelper
- func (ith *InteractiveTUIHelper) WithSize(width, height int) *InteractiveTUIHelper
- type InteractiveTestHelper
- type Listable
- type MarkdownRenderer
- type MediaHandler
- type MediaPrinter
- type MockBook
- type MockEditor
- type MockMedia
- type MockMediaFetcher
- type MovieHandler
- func (h *MovieHandler) Close() error
- func (h *MovieHandler) List(ctx context.Context, status string) error
- func (h *MovieHandler) MarkWatched(ctx context.Context, id string) error
- func (h *MovieHandler) Remove(ctx context.Context, id string) error
- func (h *MovieHandler) SearchAndAdd(ctx context.Context, query string, interactive bool) error
- func (h *MovieHandler) SetInputReader(reader io.Reader)
- func (h *MovieHandler) UpdateStatus(ctx context.Context, id, status string) error
- func (h *MovieHandler) View(ctx context.Context, movieID int64) error
- type NoteHandler
- func (h *NoteHandler) Close() error
- func (h *NoteHandler) Create(ctx context.Context, title string, content string, filePath string, ...) error
- func (h *NoteHandler) CreateWithOptions(ctx context.Context, title string, content string, filePath string, ...) error
- func (h *NoteHandler) Delete(ctx context.Context, id int64) error
- func (h *NoteHandler) Edit(ctx context.Context, id int64) error
- func (h *NoteHandler) List(ctx context.Context, static, showArchived bool, tags []string) error
- func (h *NoteHandler) View(ctx context.Context, id int64) error
- type ParsedTaskData
- type Removable
- type Searchable
- type SeedHandler
- type ServiceTestHelper
- type StatusUpdatable
- type TUICapableHandler
- type TUITestOptions
- type TUITestScenario
- type TVHandler
- func (h *TVHandler) Close() error
- func (h *TVHandler) List(ctx context.Context, status string) error
- func (h *TVHandler) MarkTVShowWatching(ctx context.Context, id string) error
- func (h *TVHandler) MarkWatched(ctx context.Context, id string) error
- func (h *TVHandler) MarkWatching(ctx context.Context, id string) error
- func (h *TVHandler) Remove(ctx context.Context, id string) error
- func (h *TVHandler) SearchAndAdd(ctx context.Context, query string, interactive bool) error
- func (h *TVHandler) SetInputReader(reader io.Reader)
- func (h *TVHandler) UpdateStatus(ctx context.Context, id, status string) error
- func (h *TVHandler) UpdateTVShowStatus(ctx context.Context, id, status string) error
- func (h *TVHandler) View(ctx context.Context, id string) error
- type TaskHandler
- func (h *TaskHandler) AddDep(ctx context.Context, taskID, dependsOnUUID string) error
- func (h *TaskHandler) BlockedByDep(ctx context.Context, taskID string) error
- func (h *TaskHandler) ClearRecur(ctx context.Context, taskID string) error
- func (h *TaskHandler) Close() error
- func (h *TaskHandler) Create(ctx context.Context, ...) error
- func (h *TaskHandler) Delete(ctx context.Context, args []string) error
- func (h *TaskHandler) Done(ctx context.Context, args []string) error
- func (h *TaskHandler) EditInteractive(ctx context.Context, taskID string) error
- func (h *TaskHandler) List(ctx context.Context, static, showAll bool, ...) error
- func (h *TaskHandler) ListContexts(ctx context.Context, static bool, todoTxt ...bool) error
- func (h *TaskHandler) ListDeps(ctx context.Context, taskID string) error
- func (h *TaskHandler) ListProjects(ctx context.Context, static bool, todoTxt ...bool) error
- func (h *TaskHandler) ListTags(ctx context.Context, static bool) error
- func (h *TaskHandler) RemoveDep(ctx context.Context, taskID, dependsOnUUID string) error
- func (h *TaskHandler) SetRecur(ctx context.Context, taskID, rule, until string) error
- func (h *TaskHandler) ShowRecur(ctx context.Context, taskID string) error
- func (h *TaskHandler) Start(ctx context.Context, taskID string, description string) error
- func (h *TaskHandler) Stop(ctx context.Context, taskID string) error
- func (h *TaskHandler) Timesheet(ctx context.Context, days int, taskID string) error
- func (h *TaskHandler) Update(ctx context.Context, ...) error
- func (h *TaskHandler) View(ctx context.Context, args []string, format string, jsonOutput, noMetadata bool) error
Constants ¶
This section is empty.
Variables ¶
var Expect = AssertionHelpers{}
Functions ¶
func AssertTaskDatesSet ¶
AssertTaskDatesSet verifies that Entry and Modified timestamps are set
func AssertTaskHasUUID ¶
AssertTaskHasUUID verifies that a task has a non-empty UUID
func CreateMockMovieSearchResults ¶
CreateMockMovieSearchResults creates sample movie search results for testing
func CreateMockTVSearchResults ¶
CreateMockTVSearchResults creates sample TV search results for testing
func CreateTestMovieService ¶
func CreateTestMovieService(mockFetcher *MockMediaFetcher) *services.MovieService
CreateTestMovieService creates a MovieService with mock dependencies for testing
func CreateTestTVService ¶
func CreateTestTVService(mockFetcher *MockMediaFetcher) *services.TVService
CreateTestTVService creates a TVService with mock dependencies for testing
func ListMediaItems ¶
func ListMediaItems[T any]( ctx context.Context, status string, mediaType string, listAll func(ctx context.Context) ([]*T, error), listByStatus func(ctx context.Context, status string) ([]*T, error), printer MediaPrinter[T], ) error
ListMediaItems is a generic utility for listing media items with status filtering
func MockOpenLibraryResponse ¶
func MockOpenLibraryResponse(books []MockBook) services.OpenLibrarySearchResponse
MockOpenLibraryResponse creates a mock OpenLibrary search response
func MockRottenTomatoesResponse ¶
MockRottenTomatoesResponse creates a mock HTML response for Rotten Tomatoes
func PrintSearchResults ¶
func PrintSearchResults[T models.Model](results []*models.Model, formatter func(*models.Model, int)) error
PrintSearchResults displays search results with a type-specific formatter
func PromptUserChoice ¶
PromptUserChoice prompts the user to select from a list of results
func RunTUIScenarios ¶
func RunTUIScenarios(t *testing.T, suite *ui.TUITestSuite, scenarios []TUITestScenario)
RunTUIScenarios executes a series of TUI test scenarios
func SetupHandlerTest ¶
func TestBookInteractiveList ¶
func TestBookInteractiveList(t *testing.T, handler *BookHandler, status string) error
TestBookInteractiveList tests book list browsing with TUI
func TestMovieInteractiveList ¶
func TestMovieInteractiveList(t *testing.T, handler *MovieHandler, status string) error
TestMovieInteractiveList tests movie list browsing with TUI
func TestNoteInteractiveList ¶
func TestNoteInteractiveList(t *testing.T, handler *NoteHandler, showArchived bool, tags []string) error
TestNoteInteractiveList tests note list browsing with TUI
func TestTVInteractiveList ¶
TestTVInteractiveList tests TV show list browsing with TUI
func TestTaskInteractiveList ¶
func TestTaskInteractiveList(t *testing.T, handler *TaskHandler, showAll bool, status, priority, project string) error
TestTaskInteractiveList tests task list browsing with TUI
Types ¶
type ArticleHandler ¶
type ArticleHandler struct {
// contains filtered or unexported fields
}
ArticleHandler handles all article-related commands
func NewArticleHandler ¶
func NewArticleHandler() (*ArticleHandler, error)
NewArticleHandler creates a new article handler
func (*ArticleHandler) Add ¶
func (h *ArticleHandler) Add(ctx context.Context, url string) error
Add handles adding an article from a URL
func (*ArticleHandler) Help ¶
func (h *ArticleHandler) Help() error
Help shows supported domains (to complement default cobra/fang help)
func (*ArticleHandler) Read ¶
func (h *ArticleHandler) Read(ctx context.Context, id int64) error
Read displays an article's content with formatted markdown rendering
type ArticleTestHelper ¶
type ArticleTestHelper struct { *ArticleHandler // contains filtered or unexported fields }
ArticleTestHelper wraps ArticleHandler with test-specific functionality
func NewArticleTestHelper ¶
func NewArticleTestHelper(t *testing.T) *ArticleTestHelper
NewArticleTestHelper creates an ArticleHandler with isolated test database
func (*ArticleTestHelper) AddTestRule ¶
func (ath *ArticleTestHelper) AddTestRule(domain string, rule *articles.ParsingRule)
AddTestRule adds a parsing rule to the handler's parser for testing
func (*ArticleTestHelper) CreateTestArticle ¶
func (ath *ArticleTestHelper) CreateTestArticle(t *testing.T, url, title, author, date string) int64
CreateTestArticle creates a test article and returns its ID
type AssertionHelpers ¶
type AssertionHelpers struct{}
AssertionHelpers provides test assertion utilities
func (AssertionHelpers) AssertArticleExists ¶
func (ah AssertionHelpers) AssertArticleExists(t *testing.T, handler *ArticleTestHelper, id int64)
AssertArticleExists checks that an article exists in the database
func (AssertionHelpers) AssertArticleNotExists ¶
func (ah AssertionHelpers) AssertArticleNotExists(t *testing.T, handler *ArticleTestHelper, id int64)
AssertArticleNotExists checks that an article does not exist in the database
func (AssertionHelpers) AssertError ¶
func (ah AssertionHelpers) AssertError(t *testing.T, err error, expectedSubstring string, msg string)
AssertError checks that an error occurred and optionally contains expected text
func (AssertionHelpers) AssertNoError ¶
func (ah AssertionHelpers) AssertNoError(t *testing.T, err error, msg string)
AssertNoError checks that no error occurred
func (AssertionHelpers) AssertNoteExists ¶
func (ah AssertionHelpers) AssertNoteExists(t *testing.T, handler *HandlerTestHelper, id int64)
AssertNoteExists checks that a note exists in the database
func (AssertionHelpers) AssertNoteNotExists ¶
func (ah AssertionHelpers) AssertNoteNotExists(t *testing.T, handler *HandlerTestHelper, id int64)
AssertNoteNotExists checks that a note does not exist in the database
type BookHandler ¶
type BookHandler struct {
// contains filtered or unexported fields
}
BookHandler handles all book-related commands
Implements MediaHandler interface for polymorphic media handling
func CreateBookHandler ¶
func CreateBookHandler(t *testing.T) *BookHandler
CreateBookHandler creates a BookHandler for testing with automatic cleanup
func NewBookHandler ¶
func NewBookHandler() (*BookHandler, error)
NewBookHandler creates a new book handler
func SetupBookHandlerWithInput ¶
func SetupBookHandlerWithInput(t *testing.T, inputs ...string) (*BookHandler, func())
SetupHandlerWithInput creates a handler and sets up input simulation in one call
func (*BookHandler) List ¶
func (h *BookHandler) List(ctx context.Context, status string) error
List lists all books with status filtering
func (*BookHandler) Remove ¶
func (h *BookHandler) Remove(ctx context.Context, id string) error
Remove removes a book from the queue
func (*BookHandler) SearchAndAdd ¶
SearchAndAdd searches for books and allows user to select and add to queue
func (*BookHandler) SetInputReader ¶
func (h *BookHandler) SetInputReader(reader io.Reader)
SetInputReader sets the input reader
func (*BookHandler) UpdateProgress ¶
UpdateProgress updates a models.Book's reading progress percentage
func (*BookHandler) UpdateStatus ¶
func (h *BookHandler) UpdateStatus(ctx context.Context, id, status string) error
UpdateStatus changes the status of a models.Book
type ConfigHandler ¶
type ConfigHandler struct {
// contains filtered or unexported fields
}
ConfigHandler handles store.Config-related operations
func NewConfigHandler ¶
func NewConfigHandler() (*ConfigHandler, error)
NewConfigHandler creates a new ConfigHandler
func (*ConfigHandler) Get ¶
func (h *ConfigHandler) Get(key string) error
Get displays one or all configuration values
func (*ConfigHandler) Path ¶
func (h *ConfigHandler) Path() error
Path displays the configuration file path
func (*ConfigHandler) Reset ¶
func (h *ConfigHandler) Reset() error
Reset resets the configuration to defaults
func (*ConfigHandler) Set ¶
func (h *ConfigHandler) Set(key, value string) error
Set updates a configuration value
type DatabaseTestHelper ¶
type DatabaseTestHelper struct {
// contains filtered or unexported fields
}
DatabaseTestHelper provides database testing utilities
func NewDatabaseTestHelper ¶
func NewDatabaseTestHelper(handler *HandlerTestHelper) *DatabaseTestHelper
NewDatabaseTestHelper creates a helper for database error testing
func (*DatabaseTestHelper) CloseDatabase ¶
func (dth *DatabaseTestHelper) CloseDatabase()
CloseDatabase closes the database connection
func (*DatabaseTestHelper) CreateCorruptedDatabase ¶
func (dth *DatabaseTestHelper) CreateCorruptedDatabase(t *testing.T)
CreateCorruptedDatabase creates a new database with corrupted schema
func (*DatabaseTestHelper) DropNotesTable ¶
func (dth *DatabaseTestHelper) DropNotesTable()
DropNotesTable drops the notes table to simulate database errors
func (*DatabaseTestHelper) RestoreDatabase ¶
func (dth *DatabaseTestHelper) RestoreDatabase(t *testing.T)
RestoreDatabase restores the original database connection
type EnvironmentTestHelper ¶
type EnvironmentTestHelper struct {
// contains filtered or unexported fields
}
EnvironmentTestHelper provides environment manipulation utilities for testing
func NewEnvironmentTestHelper ¶
func NewEnvironmentTestHelper() *EnvironmentTestHelper
NewEnvironmentTestHelper creates a new environment test helper
func (*EnvironmentTestHelper) CreateTestDir ¶
func (eth *EnvironmentTestHelper) CreateTestDir(t *testing.T) (string, error)
CreateTestDir creates a temporary test directory and sets up environment
func (*EnvironmentTestHelper) RestoreEnv ¶
func (eth *EnvironmentTestHelper) RestoreEnv()
RestoreEnv restores all modified environment variables
func (*EnvironmentTestHelper) SetEnv ¶
func (eth *EnvironmentTestHelper) SetEnv(key, value string)
SetEnv sets an environment variable and remembers the original value
func (*EnvironmentTestHelper) UnsetEnv ¶
func (eth *EnvironmentTestHelper) UnsetEnv(key string)
UnsetEnv unsets an environment variable and remembers the original value
type HTTPMockServer ¶
type HTTPMockServer struct {
// contains filtered or unexported fields
}
HTTPMockServer provides utilities for mocking HTTP services in tests
func EmptyResponseMockServer ¶
func EmptyResponseMockServer() *HTTPMockServer
EmptyResponseMockServer creates a mock server that returns empty responses
func HTTPErrorMockServer ¶
func HTTPErrorMockServer(statusCode int, message string) *HTTPMockServer
HTTPErrorMockServer creates a mock server that returns HTTP errors
func InvalidJSONMockServer ¶
func InvalidJSONMockServer() *HTTPMockServer
InvalidJSONMockServer creates a mock server that returns malformed JSON
func JSONMockServer ¶
func JSONMockServer(response any) *HTTPMockServer
JSONMockServer creates a mock server that returns JSON responses
func NewMockServer ¶
func NewMockServer() *HTTPMockServer
NewMockServer creates a new mock HTTP server
func TimeoutMockServer ¶
func TimeoutMockServer(delay time.Duration) *HTTPMockServer
TimeoutMockServer creates a mock server that simulates timeouts
func (*HTTPMockServer) GetLastRequest ¶
func (m *HTTPMockServer) GetLastRequest() *http.Request
GetLastRequest returns the last recorded HTTP request
func (*HTTPMockServer) GetRequests ¶
func (m *HTTPMockServer) GetRequests() []*http.Request
GetRequests returns all recorded HTTP requests
func (*HTTPMockServer) WithHandler ¶
func (m *HTTPMockServer) WithHandler(handler http.HandlerFunc) *HTTPMockServer
WithHandler sets up the mock server with a custom handler
type HandlerTestHelper ¶
type HandlerTestHelper struct { *NoteHandler // contains filtered or unexported fields }
HandlerTestHelper wraps NoteHandler with test-specific functionality
func NewHandlerTestHelper ¶
func NewHandlerTestHelper(t *testing.T) *HandlerTestHelper
NewHandlerTestHelper creates a NoteHandler with isolated test database
func (*HandlerTestHelper) CreateTestFile ¶
func (th *HandlerTestHelper) CreateTestFile(t *testing.T, filename, content string) string
CreateTestFile creates a temporary markdown file with content
func (*HandlerTestHelper) CreateTestNote ¶
func (th *HandlerTestHelper) CreateTestNote(t *testing.T, title, content string, tags []string) int64
CreateTestNote creates a test note and returns its ID
type InputSimulator ¶
type InputSimulator struct {
// contains filtered or unexported fields
}
InputSimulator provides controlled input simulation for testing fmt.Scanf interactions It implements io.Reader to provide predictable input sequences for interactive components
func MenuCancel ¶
func MenuCancel() *InputSimulator
MenuCancel creates input simulator for cancelling menu selection
func MenuSelection ¶
func MenuSelection(choice int) *InputSimulator
MenuSelection creates input simulator for menu selection scenarios
func MenuSequence ¶
func MenuSequence(choices ...int) *InputSimulator
MenuSequence creates input simulator for multiple menu interactions
func NewInputSimulator ¶
func NewInputSimulator(inputs ...string) *InputSimulator
NewInputSimulator creates a new input simulator with the given input sequence
func (*InputSimulator) AddInputs ¶
func (is *InputSimulator) AddInputs(inputs ...string)
AddInputs appends new inputs to the sequence
func (*InputSimulator) HasMoreInputs ¶
func (is *InputSimulator) HasMoreInputs() bool
HasMoreInputs returns true if there are more inputs available
func (*InputSimulator) Read ¶
func (is *InputSimulator) Read(p []byte) (n int, err error)
Read implements io.Reader interface for fmt.Scanf compatibility
func (*InputSimulator) Reset ¶
func (is *InputSimulator) Reset()
Reset resets the simulator to the beginning of the input sequence
type InteractiveTUIHelper ¶
type InteractiveTUIHelper struct {
// contains filtered or unexported fields
}
InteractiveTUIHelper bridges handler testing with TUI testing capabilities
func NewInteractiveTUIHelper ¶
func NewInteractiveTUIHelper(t *testing.T, handler TUICapableHandler) *InteractiveTUIHelper
NewInteractiveTUIHelper creates a helper for testing handler TUI interactions
func (*InteractiveTUIHelper) StartTUITest ¶
func (ith *InteractiveTUIHelper) StartTUITest(ctx context.Context) (*ui.TUITestSuite, error)
StartTUITest initializes and starts a TUI test session
func (*InteractiveTUIHelper) TestInteractiveList ¶
func (ith *InteractiveTUIHelper) TestInteractiveList(ctx context.Context, testFunc func(*ui.TUITestSuite) error) error
TestInteractiveList tests interactive list browsing behavior
func (*InteractiveTUIHelper) TestInteractiveNavigation ¶
func (ith *InteractiveTUIHelper) TestInteractiveNavigation(ctx context.Context, keySequence []tea.KeyType) error
TestInteractiveNavigation tests keyboard navigation patterns
func (*InteractiveTUIHelper) TestInteractiveSelection ¶
func (ith *InteractiveTUIHelper) TestInteractiveSelection(ctx context.Context, selected int, action tea.KeyType) error
TestInteractiveSelection tests item selection and actions
func (*InteractiveTUIHelper) WithMockData ¶
func (ith *InteractiveTUIHelper) WithMockData(data any) *InteractiveTUIHelper
WithMockData configures mock data for the TUI test
func (*InteractiveTUIHelper) WithSize ¶
func (ith *InteractiveTUIHelper) WithSize(width, height int) *InteractiveTUIHelper
WithSize configures the TUI test dimensions
type InteractiveTestHelper ¶
InteractiveTestHelper provides utilities for testing interactive handler components
func NewInteractiveTestHelper ¶
func NewInteractiveTestHelper() *InteractiveTestHelper
NewInteractiveTestHelper creates a helper for testing interactive components
func (*InteractiveTestHelper) GetSimulator ¶
func (ith *InteractiveTestHelper) GetSimulator() *InputSimulator
GetSimulator returns the current input simulator
func (*InteractiveTestHelper) SimulateCancel ¶
func (ith *InteractiveTestHelper) SimulateCancel() *InputSimulator
SimulateCancel sets up input simulation for cancellation
func (*InteractiveTestHelper) SimulateInput ¶
func (ith *InteractiveTestHelper) SimulateInput(inputs ...string) *InputSimulator
SimulateInput sets up input simulation for the test
func (*InteractiveTestHelper) SimulateMenuChoice ¶
func (ith *InteractiveTestHelper) SimulateMenuChoice(choice int) *InputSimulator
SimulateMenuChoice sets up input simulation for menu selection
type MarkdownRenderer ¶
type MediaHandler ¶
type MediaHandler interface { // SearchAndAdd searches for media and allows user to select and add to queue SearchAndAdd(ctx context.Context, query string, interactive bool) error // List lists all media items with optional status filtering List(ctx context.Context, status string) error // UpdateStatus changes the status of a media item UpdateStatus(ctx context.Context, id, status string) error // Remove removes a media item from the queue Remove(ctx context.Context, id string) error // SetInputReader sets the input reader for interactive prompts SetInputReader(reader io.Reader) // Close cleans up resources Close() error }
MediaHandler defines common operations for media handlers
This interface captures the shared behavior across media handlers for polymorphic handling of different media types.
type MediaPrinter ¶
type MediaPrinter[T any] func(item *T)
MediaPrinter defines how to format a media item for display
type MockEditor ¶
type MockEditor struct {
// contains filtered or unexported fields
}
MockEditor provides a mock editor function for testing
func NewMockEditor ¶
func NewMockEditor() *MockEditor
NewMockEditor creates a mock editor with default success behavior
func (*MockEditor) GetEditorFunc ¶
func (me *MockEditor) GetEditorFunc() editorFunc
GetEditorFunc returns the editor function for use with NoteHandler
func (*MockEditor) WithContent ¶
func (me *MockEditor) WithContent(content string) *MockEditor
WithContent configures the content the mock editor will write
func (*MockEditor) WithFailure ¶
func (me *MockEditor) WithFailure(msg string) *MockEditor
WithFailure configures the mock editor to fail
func (*MockEditor) WithFileDeleted ¶
func (me *MockEditor) WithFileDeleted() *MockEditor
WithFileDeleted configures the mock editor to delete the temp file
func (*MockEditor) WithReadOnly ¶
func (me *MockEditor) WithReadOnly() *MockEditor
WithReadOnly configures the mock editor to make the file read-only
type MockMediaFetcher ¶
type MockMediaFetcher struct { SearchResults []services.Media HTMLContent string MovieData *services.Movie TVSeriesData *services.TVSeries ShouldError bool ErrorMessage string }
MockMediaFetcher provides a test implementation of Fetchable and Searchable interfaces
func (*MockMediaFetcher) MakeRequest ¶
func (m *MockMediaFetcher) MakeRequest(url string) (string, error)
MakeRequest implements the Fetchable interface for testing
func (*MockMediaFetcher) MovieRequest ¶
func (m *MockMediaFetcher) MovieRequest(url string) (*services.Movie, error)
MovieRequest implements the Fetchable interface for testing
type MovieHandler ¶
type MovieHandler struct {
// contains filtered or unexported fields
}
MovieHandler handles all movie-related commands
func CreateMovieHandler ¶
func CreateMovieHandler(t *testing.T) *MovieHandler
CreateMovieHandler creates a MovieHandler for testing with automatic cleanup
func NewMovieHandler ¶
func NewMovieHandler() (*MovieHandler, error)
NewMovieHandler creates a new movie handler
func SetupMovieHandlerWithInput ¶
func SetupMovieHandlerWithInput(t *testing.T, inputs ...string) (*MovieHandler, func())
SetupMovieHandlerWithInput creates a movie handler and sets up input simulation
func (*MovieHandler) List ¶
func (h *MovieHandler) List(ctx context.Context, status string) error
List lists all movies in the queue with status filtering
func (*MovieHandler) MarkWatched ¶
func (h *MovieHandler) MarkWatched(ctx context.Context, id string) error
MarkWatched marks a movie as watched
func (*MovieHandler) Remove ¶
func (h *MovieHandler) Remove(ctx context.Context, id string) error
Remove removes a movie from the queue
func (*MovieHandler) SearchAndAdd ¶
SearchAndAdd searches for movies and allows user to select and add to queue
func (*MovieHandler) SetInputReader ¶
func (h *MovieHandler) SetInputReader(reader io.Reader)
SetInputReader sets the input reader
func (*MovieHandler) UpdateStatus ¶
func (h *MovieHandler) UpdateStatus(ctx context.Context, id, status string) error
UpdateStatus changes the status of a movie
type NoteHandler ¶
type NoteHandler struct {
// contains filtered or unexported fields
}
NoteHandler handles all note-related commands
func NewNoteHandler ¶
func NewNoteHandler() (*NoteHandler, error)
NewNoteHandler creates a new note handler
func (*NoteHandler) Create ¶
func (h *NoteHandler) Create(ctx context.Context, title string, content string, filePath string, interactive bool) error
Create handles note creation with optional title, content, and file path
func (*NoteHandler) CreateWithOptions ¶
func (h *NoteHandler) CreateWithOptions(ctx context.Context, title string, content string, filePath string, interactive bool, promptEditor bool) error
CreateWithOptions handles note creation with additional options
func (*NoteHandler) Delete ¶
func (h *NoteHandler) Delete(ctx context.Context, id int64) error
Delete permanently removes a note and its metadata
func (*NoteHandler) Edit ¶
func (h *NoteHandler) Edit(ctx context.Context, id int64) error
Edit handles note editing by ID
type ParsedTaskData ¶
type ParsedTaskData struct { Description string Project string Context string Tags []string Due string Recur string Until string ParentUUID string DependsOn []string }
ParsedTaskData holds extracted metadata from a task description
type Searchable ¶
type Searchable interface {
SearchAndAdd(ctx context.Context, query string, interactive bool) error
}
Searchable defines search behavior for media handlers
type SeedHandler ¶
type SeedHandler struct {
// contains filtered or unexported fields
}
SeedHandler handles database seeding operations
func NewSeedHandler ¶
func NewSeedHandler() (*SeedHandler, error)
NewSeedHandler creates a new seed handler
type ServiceTestHelper ¶
type ServiceTestHelper struct {
// contains filtered or unexported fields
}
ServiceTestHelper provides utilities for testing services with HTTP mocks
func NewServiceTestHelper ¶
func NewServiceTestHelper() *ServiceTestHelper
NewServiceTestHelper creates a new service test helper
func (*ServiceTestHelper) AddMockServer ¶
func (sth *ServiceTestHelper) AddMockServer(server *HTTPMockServer) string
AddMockServer adds a mock server and returns its URL
func (*ServiceTestHelper) AssertRequestMade ¶
func (sth *ServiceTestHelper) AssertRequestMade(t *testing.T, server *HTTPMockServer, expectedPath string)
AssertRequestMade verifies that a request was made to the mock server
func (*ServiceTestHelper) Cleanup ¶
func (sth *ServiceTestHelper) Cleanup()
Cleanup closes all mock servers
type StatusUpdatable ¶
StatusUpdatable defines status update behavior for media handlers
type TUICapableHandler ¶
type TUICapableHandler interface { GetTUIModel(ctx context.Context, opts TUITestOptions) (tea.Model, error) SetTUITestMode(enabled bool) }
TUICapableHandler interface for handlers that can expose TUI models for testing
type TUITestOptions ¶
type TUITestOptions struct { Width int Height int Static bool Output io.Writer Input io.Reader MockData any }
TUITestOptions configures TUI testing behavior for handlers
type TUITestScenario ¶
type TUITestScenario struct { Name string KeySequence []tea.KeyType ExpectedView string Timeout time.Duration }
TUITestScenario defines a common test scenario for interactive components
func CommonTUIScenarios ¶
func CommonTUIScenarios() []TUITestScenario
CommonTUIScenarios returns standard TUI testing scenarios
type TVHandler ¶
type TVHandler struct {
// contains filtered or unexported fields
}
TVHandler handles all TV show-related commands
Implements MediaHandler interface for polymorphic media handling
func CreateTVHandler ¶
CreateTVHandler creates a TVHandler for testing with automatic cleanup
func SetupTVHandlerWithInput ¶
SetupTVHandlerWithInput creates a TV handler and sets up input simulation
func (*TVHandler) MarkTVShowWatching ¶
MarkTVShowWatching marks a TV show as currently watching
func (*TVHandler) MarkWatched ¶
MarkWatched marks a TV show as watched
func (*TVHandler) MarkWatching ¶
MarkWatching marks a TV show as currently watching
func (*TVHandler) SearchAndAdd ¶
SearchAndAdd searches for TV shows and allows user to select and add to queue
func (*TVHandler) SetInputReader ¶
SetInputReader sets the input reader
func (*TVHandler) UpdateStatus ¶
UpdateStatus changes the status of a TV show
func (*TVHandler) UpdateTVShowStatus ¶
UpdateTVShowStatus changes the status of a TV show
type TaskHandler ¶
type TaskHandler struct {
// contains filtered or unexported fields
}
TaskHandler handles all task-related commands
func CreateTaskHandler ¶
func CreateTaskHandler(t *testing.T) *TaskHandler
CreateTaskHandler creates a TaskHandler for testing with automatic cleanup
func NewTaskHandler ¶
func NewTaskHandler() (*TaskHandler, error)
NewTaskHandler creates a new task handler
func (*TaskHandler) AddDep ¶
func (h *TaskHandler) AddDep(ctx context.Context, taskID, dependsOnUUID string) error
AddDep adds a dependency to a task
func (*TaskHandler) BlockedByDep ¶
func (h *TaskHandler) BlockedByDep(ctx context.Context, taskID string) error
BlockedByDep shows tasks that are blocked by the given task
func (*TaskHandler) ClearRecur ¶
func (h *TaskHandler) ClearRecur(ctx context.Context, taskID string) error
ClearRecur clears the recurrence rule from a task
func (*TaskHandler) Create ¶
func (h *TaskHandler) Create(ctx context.Context, description, priority, project, context, due, recur, until, parentUUID, dependsOn string, tags []string) error
Create creates a new task
func (*TaskHandler) Delete ¶
func (h *TaskHandler) Delete(ctx context.Context, args []string) error
Delete deletes a task
func (*TaskHandler) Done ¶
func (h *TaskHandler) Done(ctx context.Context, args []string) error
Done marks a task as completed
func (*TaskHandler) EditInteractive ¶
func (h *TaskHandler) EditInteractive(ctx context.Context, taskID string) error
EditInteractive opens an interactive task editor with status picker and priority toggle
func (*TaskHandler) List ¶
func (h *TaskHandler) List(ctx context.Context, static, showAll bool, status, priority, project, context string) error
List lists all tasks with optional filtering
func (*TaskHandler) ListContexts ¶
ListContexts lists all contexts with their task counts
func (*TaskHandler) ListDeps ¶
func (h *TaskHandler) ListDeps(ctx context.Context, taskID string) error
ListDeps lists all dependencies for a task
func (*TaskHandler) ListProjects ¶
ListProjects lists all projects with their task counts
func (*TaskHandler) ListTags ¶
func (h *TaskHandler) ListTags(ctx context.Context, static bool) error
ListTags lists all tags with their task counts
func (*TaskHandler) RemoveDep ¶
func (h *TaskHandler) RemoveDep(ctx context.Context, taskID, dependsOnUUID string) error
RemoveDep removes a dependency from a task
func (*TaskHandler) SetRecur ¶
func (h *TaskHandler) SetRecur(ctx context.Context, taskID, rule, until string) error
SetRecur sets the recurrence rule for a task
func (*TaskHandler) ShowRecur ¶
func (h *TaskHandler) ShowRecur(ctx context.Context, taskID string) error
ShowRecur displays the recurrence details for a task
func (*TaskHandler) Stop ¶
func (h *TaskHandler) Stop(ctx context.Context, taskID string) error
Stop stops time tracking for a task