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

WORLDSERVICE-79: Enable Reverb on LIVE for PIDGIN #12375

Open
wants to merge 16 commits into
base: latest
Choose a base branch
from

Conversation

alex-magana
Copy link
Contributor

@alex-magana alex-magana commented Feb 6, 2025

Resolves JIRA WORLDSERVICE-79

Overall changes

Enable Reverb tracking for PIDGIN on LIVE.

Code changes

  • Remove the isLive check to lift the restriction barring Reverb tracking on LIVE.

Testing

  1. Visit a LIVE assets such as https://www.bbc.com/pidgin/articles/cevee1j7ymyo
  2. From the Network tab, verify that page view tracking and component event tracking is done via Reverb.

Helpful Links

Add Links to useful resources related to this PR if applicable.

Coding Standards

Repository use guidelines

@alex-magana alex-magana marked this pull request as ready for review February 7, 2025 09:53
@@ -80,6 +80,14 @@ describe('sendBeacon', () => {
expect(reverbMock.viewEvent).toHaveBeenCalledTimes(1);
});

it('should not call Reverb viewEvent if Reverb is not enabled for a service', async () => {
const sendBeacon = require('./index').default;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be better to declare the sendBeacon at a higher level within the describe block so that it can be re-used for each unit test or does it have to be declared each time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated how the test is set up to enable us to mock onClient
in a manner that enables use to import sendBeacon once.

Copy link
Contributor

@pvaliani pvaliani left a comment

Choose a reason for hiding this comment

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

Nice one! looking forward to seeing it on Live

@@ -80,6 +80,14 @@ describe('sendBeacon', () => {
expect(reverbMock.viewEvent).toHaveBeenCalledTimes(1);
});

it('should not call Reverb viewEvent if Reverb is not enabled for a service', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if I understand these "if Reverb is not enabled for a service" tests - I can't see where this is declared in the test file - could we make it a bit more explicit - perhaps by mocking the service context or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As these are unit tests, mocking the ServiceContext may not yield the desired
outcome. I've declared a variable here with an annotation to indicate the scenario
where the argument, reverbBeaconConfig, would be passed as null.

This relates to the conditional check in ATIAnalytics and sendEventBeacon
where reverbBeaconConfig resolves to null.

Additionally, I've added integration tests here and here to assert Reverb values resolve
to null when Reverb is disabled for a service.

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

Successfully merging this pull request may close these issues.

4 participants