Skip to content

test(browser-plugin-media): cover updateMediaTracking mid-session empty-string stripping [AISP-1625] - #1497

Draft
snowplow-claude-review[bot] wants to merge 1 commit into
masterfrom
loop/jira-AISP-1625-snowplow-javascript-tracker
Draft

snowplow-claude-review[bot] wants to merge 1 commit into
masterfrom
loop/jira-AISP-1625-snowplow-javascript-tracker

Conversation

@snowplow-claude-review

Copy link
Copy Markdown
Contributor

What

Adds a Jest test for the updateMediaTracking mid-session path in the media plugin.

buildMediaPlayerEntity in plugins/browser-plugin-media/src/core.ts already deletes label, playerType, and quality when they equal '' before the entity is emitted. The existing tests in test/api.test.ts verified this only at startMediaTracking time. This PR adds the missing case: a session started with a non-empty label, followed by updateMediaTracking({ label: '' }) and trackMediaPlay, asserts that label is absent from the media player context entity on the subsequent event.

Why it matters

The updateMediaTracking path merges the supplied options into player state and then routes through buildMediaPlayerEntity on every subsequent track call (api.ts:109-114). Without this test, a regression in the state-merge path could reintroduce the empty-string emission without any test failure.

What to review

  • plugins/browser-plugin-media/test/api.test.ts: the new test block — check that the assertion (label key absent from the entity properties) correctly targets the right context entity and property name.

Draft PR opened for review — please verify and run CI before merging.

@snowplowcla

Copy link
Copy Markdown

Thanks for your pull request. Is this your first contribution to a Snowplow open source project? Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://docs.snowplowanalytics.com/docs/contributing/contributor-license-agreement/ to learn more and sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.

@snowplowcla Snowplow CLA bot (snowplowcla) added the cla:no [Auto generated] Snowplow Contributor License Agreement has not been signed. label Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla:no [Auto generated] Snowplow Contributor License Agreement has not been signed.

Development

Successfully merging this pull request may close these issues.

1 participant