meta db unit tests and fixes
This commit is contained in:
parent
161208a1fd
commit
08379ea622
@ -249,4 +249,35 @@ TYPED_TEST(meta_db_test, can_get_individual_item_meta_for_file) {
|
|||||||
EXPECT_STREQ(source_path.c_str(), value.c_str());
|
EXPECT_STREQ(source_path.c_str(), value.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TYPED_TEST(meta_db_test, can_get_pinned_files) {
|
||||||
|
std::vector<std::string> pinned_files{};
|
||||||
|
std::vector<std::string> unpinned_files{};
|
||||||
|
for (auto idx = 0U; idx < 20U; ++idx) {
|
||||||
|
auto test_file = create_test_file();
|
||||||
|
auto pinned = idx % 2U == 0U;
|
||||||
|
EXPECT_EQ(
|
||||||
|
api_error::success,
|
||||||
|
this->meta_db->set_item_meta(
|
||||||
|
test_file, {
|
||||||
|
{META_DIRECTORY, utils::string::from_bool(false)},
|
||||||
|
{META_PINNED, utils::string::from_bool(pinned)},
|
||||||
|
}));
|
||||||
|
if (pinned) {
|
||||||
|
pinned_files.push_back(test_file);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
unpinned_files.push_back(test_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto pinned = this->meta_db->get_pinned_files();
|
||||||
|
EXPECT_GE(pinned.size(), pinned_files.size());
|
||||||
|
for (const auto &api_path : pinned_files) {
|
||||||
|
EXPECT_TRUE(utils::collection::includes(pinned, api_path));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto &api_path : unpinned_files) {
|
||||||
|
EXPECT_TRUE(utils::collection::excludes(pinned, api_path));
|
||||||
|
}
|
||||||
|
}
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
Loading…
x
Reference in New Issue
Block a user