Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Native SDK Core Unit Tests (Part I, II, Events) #333

Merged
merged 24 commits into from
Oct 16, 2024

Conversation

parag-pv
Copy link
Contributor

@parag-pv parag-pv commented Oct 3, 2024

  • Added unit tests for 3 event methods under accessibility module.
  • 6 tests in total. Each method has subscribe and unsubscribe.

@CLAassistant
Copy link

CLAassistant commented Oct 3, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

github-actions bot commented Oct 3, 2024

MFOS standalone sanity report - CORE,MANAGE,DISCOVERY:
Total Passes - 498 Failures - 0 Pending - 0 Skipped - 28
Report JSON/HTML Files: https://github.com/rdkcentral/firebolt-apis/suites/29144340035/artifacts/2008720902
Job Logs: https://github.com/rdkcentral/firebolt-apis/actions/runs/11153766817

@parag-pv parag-pv requested a review from kschrief October 3, 2024 14:23
Copy link

github-actions bot commented Oct 3, 2024

MFOS standalone sanity report - CORE,MANAGE,DISCOVERY:
Total Passes - 498 Failures - 0 Pending - 0 Skipped - 28
Report JSON/HTML Files: https://github.com/rdkcentral/firebolt-apis/suites/29181929481/artifacts/2012414856
Job Logs: https://github.com/rdkcentral/firebolt-apis/actions/runs/11167501535

@ksentak ksentak changed the title Feat: Native SDK Core events unit tests Feat: Native SDK Core Unit Tests (Part I, II, Events) Oct 4, 2024
Copy link

github-actions bot commented Oct 4, 2024

MFOS standalone sanity report - CORE,MANAGE,DISCOVERY:
Total Passes - 498 Failures - 0 Pending - 0 Skipped - 28
Report JSON/HTML Files: https://github.com/rdkcentral/firebolt-apis/suites/29227123747/artifacts/2017020066
Job Logs: https://github.com/rdkcentral/firebolt-apis/actions/runs/11184396659

if (closedCaptions.styles.has_value()) {
const auto& styles = closedCaptions.styles.value();

if (styles.backgroundColor.has_value())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if styles.background doesn't have a value? Will this pass or fail? Is there a way to enforce that if our example has "styles.backgroundColor" then the result should and fail if that's not the case? This applies to all other elements as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're correct that the current implementation does not explicitly enforce that styles.backgroundColor and other fields must exist in both the actual result and the expected values. If the actual result is missing a field while the expected values contain it, the test will simply skip the EXPECT_EQ comparison, which could potentially lead to false positives if the field was expected but not present.

We could maybe do something like this:

if (expectedValues["styles"].contains("backgroundColor")) {
    ASSERT_TRUE(styles.backgroundColor.has_value()) << "Expected backgroundColor, but it is missing";
    EXPECT_EQ(styles.backgroundColor.value(), expectedValues["styles"]["backgroundColor"]);
}

{
// Hardcoded expected values
Firebolt::Device::AudioProfiles expectedValues;
expectedValues.stereo = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we hard-coding the values instead of getting them from the OpenRPC here? I'm assuming it has something to do with the name but if those values ever change this will fail.

@kschrief kschrief merged commit 284b207 into next Oct 16, 2024
8 checks passed
@kschrief kschrief deleted the feature/native-core-events-unit-tests branch October 16, 2024 15:36
@kschrief
Copy link
Contributor

🎉 This PR is included in version 1.5.0-next.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants