Skip to content

Commit

Permalink
feat(core): Profile module unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaKasar committed Sep 23, 2024
1 parent 64bc9e3 commit 39914c5
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions src/sdks/core/src/cpp/sdk/cpptest/unit/profileTest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#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 value = Firebolt::IFireboltAccessor::Instance().ProfileInterface().approveContentRating(&error);

EXPECT_EQ(error, Firebolt::Error::None);
EXPECT_EQ(value, expectedValues);
}


TEST_F(ProfileTest, ApprovePurchase)
{

nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Profile.approvePurchase"));

bool value = Firebolt::IFireboltAccessor::Instance().ProfileInterface().approvePurchase(&error);

EXPECT_EQ(error, Firebolt::Error::None);
EXPECT_EQ(value, 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);
EXPECT_EQ(flag["userExperience"], expectedValues["userExperience"]);
}

0 comments on commit 39914c5

Please sign in to comment.