diff --git a/repertory/repertory_test/src/meta_db_test.cpp b/repertory/repertory_test/src/meta_db_test.cpp index 87d90bc9..7397fd21 100644 --- a/repertory/repertory_test/src/meta_db_test.cpp +++ b/repertory/repertory_test/src/meta_db_test.cpp @@ -49,6 +49,32 @@ TYPED_TEST(meta_db_test, can_get_api_path_from_source_path) { EXPECT_STREQ(test_file.c_str(), api_path.c_str()); } +TYPED_TEST(meta_db_test, can_change_source_path) { + auto test_file = create_test_file(); + auto test_source = create_test_file(); + auto test_source2 = create_test_file(); + EXPECT_EQ( + api_error::success, + this->meta_db->set_item_meta( + test_file, { + {META_DIRECTORY, utils::string::from_bool(false)}, + {META_SOURCE, test_source}, + })); + + EXPECT_EQ(api_error::success, + this->meta_db->set_item_meta(test_file, META_SOURCE, test_source2)); + + std::string api_path; + EXPECT_EQ(api_error::success, + this->meta_db->get_api_path(test_source2, api_path)); + EXPECT_STREQ(test_file.c_str(), api_path.c_str()); + + std::string api_path2; + EXPECT_EQ(api_error::item_not_found, + this->meta_db->get_api_path(test_source, api_path2)); + EXPECT_TRUE(api_path2.empty()); +} + TYPED_TEST(meta_db_test, get_api_path_return_item_not_found_if_source_does_not_exist) { std::string api_path;