Skip to content

Commit eafe257

Browse files
committed
test(core): Profile module unit tests
1 parent ff30357 commit eafe257

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#include "unit.h"
2+
#include "common/types.h"
3+
4+
class ProfileTest : public ::testing::Test
5+
{
6+
protected:
7+
JsonEngine *jsonEngine;
8+
Firebolt::Error error = Firebolt::Error::None;
9+
10+
void SetUp() override
11+
{
12+
jsonEngine = new JsonEngine();
13+
}
14+
15+
void TearDown() override
16+
{
17+
delete jsonEngine;
18+
}
19+
};
20+
21+
TEST_F(ProfileTest, ApproveContentRating)
22+
{
23+
24+
nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Profile.approveContentRating"));
25+
26+
bool status = Firebolt::IFireboltAccessor::Instance().ProfileInterface().approveContentRating(&error);
27+
28+
EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Profile.approveContentRating() method";
29+
EXPECT_EQ(status, expectedValues);
30+
}
31+
32+
TEST_F(ProfileTest, ApprovePurchase)
33+
{
34+
35+
nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Profile.approvePurchase"));
36+
37+
bool status = Firebolt::IFireboltAccessor::Instance().ProfileInterface().approvePurchase(&error);
38+
39+
EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Profile.approvePurchase() method";
40+
EXPECT_EQ(status, expectedValues);
41+
}
42+
43+
TEST_F(ProfileTest, Flags)
44+
{
45+
46+
nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Profile.flags"));
47+
48+
Firebolt::Types::FlatMap flag = Firebolt::IFireboltAccessor::Instance().ProfileInterface().flags(&error);
49+
50+
EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve flag from Profile.flags() method";
51+
EXPECT_EQ(flag["userExperience"], expectedValues["userExperience"]);
52+
}

0 commit comments

Comments
 (0)