summaryrefslogtreecommitdiff
path: root/battleNetApi/tests/tests.cpp
blob: 0831e79a69721f2ec2f77e8d47bf78ae89538209 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "apiUrl.hpp"
#include "hearthstoneApi.hpp"
#include <catch2/catch_test_macros.hpp>
#include <utility>

TEST_CASE("Retrieve API Token", "[getApiToken]") {
    const std::string kCredentialsFile{"tests/resources/credentials.json"};
    Token aToken(kCredentialsFile);
    const std::string kTokenContent{aToken.text()};
    const std::string::size_type kTokenSize{kTokenContent.size()};
    REQUIRE(kTokenSize >= 30);
    REQUIRE(kTokenSize <= 40);
}

// TEST_CASE("Retrieve number of cards", "[getCardsCount]") {
//     HearthstoneApiMock aHearthstoneApi;
//     const std::string kContentType{"cards"};
//     const std::string kRegion{"eu"};
//     ApiUrl aApiUrl(kContentType, kRegion);
//     aApiUrl.setLocale("fr_FR");
//     aApiUrl.setGameMode("constructed");
//     aApiUrl.setPageSize("1");
//     std::uint64_t kNumberOfCards{aHearthstoneApi.numberOfCards(aHearthstoneApi.makeApiRequest(aApiUrl()))};
//     REQUIRE(kNumberOfCards == 6033);
// }
//
// TEST_CASE("Retrieve cards", "[retrieveCards]") {
//     HearthstoneApiMock aHearthstoneApi;
//     const std::string kContentType{"cards"};
//     const std::string kRegion{"eu"};
//     ApiUrl aApiUrl(kContentType, kRegion);
//     aApiUrl.setLocale("fr_FR");
//     aApiUrl.setGameMode("constructed");
//     aApiUrl.setPageSize("10");
//     const std::string kApiResponse{aHearthstoneApi.makeApiRequest(aApiUrl())};
//     REQUIRE(kApiResponse.size() > 5000);
// }