Skip to content

test: Add Test Coverage for selectPlacements call#14

Merged
alexs-mparticle merged 7 commits intodevelopmentfrom
fix/SQDSDKS-7170-filtering-tests
Mar 31, 2025
Merged

test: Add Test Coverage for selectPlacements call#14
alexs-mparticle merged 7 commits intodevelopmentfrom
fix/SQDSDKS-7170-filtering-tests

Conversation

@alexs-mparticle
Copy link
Collaborator

Summary

  • Adds test coverage for selectPlacements call

Testing Plan

  • Run Automated Tests

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds test coverage for the selectPlacements call in the Rokt Forwarder.

  • New tests verify that selectPlacements is called with the correct options.
  • Tests confirm that user attribute filtering is applied as expected when passed through configuration and options.
Comments suppressed due to low confidence (1)

test/src/tests.js:120

  • The async function for attachKit does not explicitly return a promise. To ensure consistent asynchronous behavior, consider adding 'return Promise.resolve();' within the function body.
window.mParticle.Rokt.attachKit = async () => {

Comment on lines 110 to 112
await waitForCondition(
() => window.mParticle.Rokt.attachKitCalled === true
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this needed? there's no assertion below this


it('should process user attributes filters that are passed in via the config and selectPlacements options', async () => {
window.mParticle.forwarder.filters = {
userAttributesFilters: [],
Copy link
Collaborator

Choose a reason for hiding this comment

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

the test says it will process the user attribute filters that are passed on the config, but there are no filters here, so the attributes end up being the same as what is passed in.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Technically the filters are used by filterUserAttributes via the Core SDK, and in this case we're mocking that function. The true purpose of this test is to verify that selectPlacements is correctly using the results of filterUserAttributes. Hope this change helps.

Co-authored-by: Robert Ing <ring@mparticle.com>
@alexs-mparticle alexs-mparticle requested a review from Copilot March 31, 2025 14:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds test coverage for the selectPlacements call in the Rokt Forwarder tests. The changes include:

  • Removal of an unused asynchronous waitForCondition helper function.
  • Addition of three new tests to verify the proper behavior of selectPlacements, including handling of filtering logic.
Comments suppressed due to low confidence (1)

test/src/tests.js:186

  • Consider correcting the spelling of 'durring' to 'during'.
            // Also, any initial attributes from the init call that have updated durring runtime should be returned by the filterUserAttribute method.

@alexs-mparticle alexs-mparticle merged commit e0a10ef into development Mar 31, 2025
4 checks passed
crisryantan added a commit that referenced this pull request Apr 1, 2025
…ion-name

* development:
  test: Add Test Coverage for selectPlacements call (#14)
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.

2 participants