-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(core): Profile module unit tests
- Loading branch information
1 parent
ff30357
commit eafe257
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include "unit.h" | ||
#include "common/types.h" | ||
|
||
class ProfileTest : public ::testing::Test | ||
{ | ||
protected: | ||
JsonEngine *jsonEngine; | ||
Firebolt::Error error = Firebolt::Error::None; | ||
|
||
void SetUp() override | ||
{ | ||
jsonEngine = new JsonEngine(); | ||
} | ||
|
||
void TearDown() override | ||
{ | ||
delete jsonEngine; | ||
} | ||
}; | ||
|
||
TEST_F(ProfileTest, ApproveContentRating) | ||
{ | ||
|
||
nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Profile.approveContentRating")); | ||
|
||
bool status = Firebolt::IFireboltAccessor::Instance().ProfileInterface().approveContentRating(&error); | ||
|
||
EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Profile.approveContentRating() method"; | ||
EXPECT_EQ(status, expectedValues); | ||
} | ||
|
||
TEST_F(ProfileTest, ApprovePurchase) | ||
{ | ||
|
||
nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Profile.approvePurchase")); | ||
|
||
bool status = Firebolt::IFireboltAccessor::Instance().ProfileInterface().approvePurchase(&error); | ||
|
||
EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Profile.approvePurchase() method"; | ||
EXPECT_EQ(status, expectedValues); | ||
} | ||
|
||
TEST_F(ProfileTest, Flags) | ||
{ | ||
|
||
nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Profile.flags")); | ||
|
||
Firebolt::Types::FlatMap flag = Firebolt::IFireboltAccessor::Instance().ProfileInterface().flags(&error); | ||
|
||
EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve flag from Profile.flags() method"; | ||
EXPECT_EQ(flag["userExperience"], expectedValues["userExperience"]); | ||
} |