chromium/components/plus_addresses/plus_address_parsing_utils_unittest.cc

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/plus_addresses/plus_address_parsing_utils.h"

#include <optional>

#include "base/json/json_reader.h"
#include "base/types/expected.h"
#include "components/plus_addresses/plus_address_test_utils.h"
#include "components/plus_addresses/plus_address_types.h"
#include "services/data_decoder/public/cpp/data_decoder.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace plus_addresses {

ElementsAre;
Optional;

// PlusAddressParsing tests validate the ParsePlusAddressFrom* methods
// Returns empty when the DataDecoder fails to parse the JSON.
TEST(PlusAddressParsing, NotValidJson) {}

TEST(PlusAddressParsing, FromV1Create_ParsesSuccessfully) {}

// Validate that there is a plusAddress field in the plusEmail object.
TEST(PlusAddressParsing, FromV1Create_FailsWithoutPlusAddress) {}

// Validate that there is a plusMode field in the plusEmail object.
TEST(PlusAddressParsing, FromV1Create_FailsWithoutPlusMode) {}

// Validate that there is a plusEmail object.
TEST(PlusAddressParsing, FromV1Create_FailsWithoutEmailObject) {}

TEST(PlusAddressParsing, FromV1Create_FailsForEmptyDict) {}

TEST(PlusAddressParsing, FromV1Create_FailsWithoutPlusProfileKey) {}

TEST(PlusAddressParsing, FromV1Create_FailsIfPlusProfileIsNotDict) {}

TEST(PlusAddressParsing, ParsePreallocatedPlusAddresses) {}

TEST(PlusAddressParsing, ParsePreallocatedPlusAddressesWithInvalidJSON) {}

// Tests that `ParsePreallocatedPlusAddresses` ignores malformed entries.
TEST(PlusAddressParsing, ParsePreallocatedPlusAddressesWithMalformedEntries) {}

// Tests that `ParsePreallocatedPlusAddresses` returns `std::nullopt` if the
// top-level entry does not have the expected format.
TEST(PlusAddressParsing,
     ParsePreallocatedPlusAddressesWithMalformedTopLevelEntry) {}

}  // namespace plus_addresses