|
| 1 | +/* Copyright (c) 2020 The Brave Authors. All rights reserved. |
| 2 | + * This Source Code Form is subject to the terms of the Mozilla Public |
| 3 | + * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
| 4 | + * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 5 | + |
| 6 | +#include "bat/ads/internal/server/ads_serve_server_util.h" |
| 7 | + |
| 8 | +#include "testing/gtest/include/gtest/gtest.h" |
| 9 | +#include "bat/ads/internal/unittest_util.h" |
| 10 | + |
| 11 | +// npm run test -- brave_unit_tests --filter=BatAds* |
| 12 | + |
| 13 | +namespace ads { |
| 14 | + |
| 15 | +TEST(BatAdsServeServerUtilTest, |
| 16 | + Production) { |
| 17 | + // Arrange |
| 18 | + SetEnvironment(Environment::PRODUCTION); |
| 19 | + |
| 20 | + // Act |
| 21 | + const std::string host = serve::server::GetHost(); |
| 22 | + |
| 23 | + // Assert |
| 24 | + const std::string expected_host = "https://ads-serve.brave.com"; |
| 25 | + EXPECT_EQ(expected_host, host); |
| 26 | +} |
| 27 | + |
| 28 | +TEST(BatAdsServeServerUtilTest, |
| 29 | + Staging) { |
| 30 | + // Arrange |
| 31 | + SetEnvironment(Environment::STAGING); |
| 32 | + |
| 33 | + // Act |
| 34 | + const std::string host = serve::server::GetHost(); |
| 35 | + |
| 36 | + // Assert |
| 37 | + const std::string expected_host = "https://ads-serve.bravesoftware.com"; |
| 38 | + EXPECT_EQ(expected_host, host); |
| 39 | +} |
| 40 | + |
| 41 | +TEST(BatAdsServeServerUtilTest, |
| 42 | + Development) { |
| 43 | + // Arrange |
| 44 | + SetEnvironment(Environment::DEVELOPMENT); |
| 45 | + |
| 46 | + // Act |
| 47 | + const std::string host = serve::server::GetHost(); |
| 48 | + |
| 49 | + // Assert |
| 50 | + const std::string expected_host = "https://ads-serve.brave.software"; |
| 51 | + EXPECT_EQ(expected_host, host); |
| 52 | +} |
| 53 | + |
| 54 | +} // namespace ads |
0 commit comments