24#include <gtest/gtest.h>
50using svcs::services::Event;
51using svcs::core::RepositoryManager;
52using svcs::cli::HistoryCommand;
89 void SetUp()
override;
113 void createTestFile(
const std::string& filename,
const std::string& content)
const;
135 void stageFiles(
const std::vector<std::string>& files)
const;
165 static bool containsMessage(
const std::vector<Event>& notifications,
const std::string& message);
180 int countMessages(
const std::vector<Event>& notifications,
const std::string& message);
207 std::unique_ptr<HistoryCommand>
command;
Declaration of the HistoryCommand class for viewing save history (commits).
A mock implementation of ISubject for testing event-driven components.
Definition MockSubject.hxx:43
Google Test fixture for running integration tests against the HistoryCommand.
Definition IntHistoryCommandTest.hxx:53
void createTestDirectory(const std::string &dirname) const
Creates a test directory in the temporary location.
Definition IntHistoryCommandTest.cxx:55
std::shared_ptr< RepositoryManager > repoManager
Shared pointer to the repository core logic component.
Definition IntHistoryCommandTest.hxx:128
bool createTestCommit(const std::string &message)
Creates a new commit (save) with a specified message.
Definition IntHistoryCommandTest.cxx:65
void SetUp() override
Sets up the testing environment before each test.
Definition IntHistoryCommandTest.cxx:22
std::shared_ptr< MockSubject > mockEventBus
Shared pointer to the mock event bus (observer).
Definition IntHistoryCommandTest.hxx:122
void stageFiles(const std::vector< std::string > &files) const
Stages a list of files using the RepositoryManager's staging logic.
Definition IntHistoryCommandTest.cxx:59
std::unique_ptr< HistoryCommand > command
Unique pointer to the command being tested.
Definition IntHistoryCommandTest.hxx:134
static bool containsMessage(const std::vector< Event > ¬ifications, const std::string &message)
Checks if a specific message (substring) exists in any event notification.
Definition IntHistoryCommandTest.cxx:70
void createTestFile(const std::string &filename, const std::string &content) const
Creates a test file with specified content in the temporary directory.
Definition IntHistoryCommandTest.cxx:49
int countMessages(const std::vector< Event > ¬ifications, const std::string &message)
Counts the occurrences of a specific message (substring) across all event notifications.
Definition IntHistoryCommandTest.cxx:78
void TearDown() override
Tears down the testing environment after each test.
Definition IntHistoryCommandTest.cxx:43
std::filesystem::path testDir
Path to the temporary test repository directory.
Definition IntHistoryCommandTest.hxx:140
Mock implementation of the ISubject interface for unit testing purposes.
Utility classes and test fixtures for CLI command testing.
Definition ClearCommandTest.cxx:17