/*
 * Copyright (C) 2026 UBports Foundation.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 3 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "../../src/vendors/LocalVendor.h"
#include "../../src/vendors/Vendor.h"

#include <gtest/gtest.h>

using namespace std;
using namespace lomiri::storage::provider;

TEST(LocalVendor, for_context)
{
    auto local = Vendor::for_context(LocalVendor::test_context("/tmp/lsf-rclone"));
    EXPECT_NE(nullptr, dynamic_cast<LocalVendor*>(local.get()));
}

TEST(LocalVendor, is_valid_context)
{
    EXPECT_TRUE(LocalVendor::is_valid_context(
        LocalVendor::test_context("/tmp/lsf-rclone")));

    EXPECT_FALSE(LocalVendor::is_valid_context(Context()));
    EXPECT_FALSE(LocalVendor::is_valid_context(LocalVendor::test_context("")));
    EXPECT_FALSE(LocalVendor::is_valid_context(
        LocalVendor::test_context("example.com")));
}
