Skip to content

[CI-4285] Update tests#371

Merged
esezen merged 2 commits intomasterfrom
ci-4285-client-js-update-tests
Apr 10, 2025
Merged

[CI-4285] Update tests#371
esezen merged 2 commits intomasterfrom
ci-4285-client-js-update-tests

Conversation

@esezen
Copy link
Contributor

@esezen esezen commented Mar 24, 2025

No description provided.

// Response
expect(responseParams).to.have.property('method').to.equal('POST');
expect(responseParams).to.have.property('message').to.equal('conversion type must be one of add_to_wishlist, add_to_cart, like, message, make_offer, read. If you wish to use custom types, please set is_custom_type to true and specify a display_name.');
expect(responseParams).to.have.property('message').to.equal('Invalid parameters');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The error message has been moved to response.errors[x].message but we don't emit that in our RequestQueue at the moment on errors. I didn't want to change the implementation just because of this

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know if this is how errors are going to be surfaced moving forward? If so, it shouldn't be too hard to add it as a part of the emitted event (and it should be backwards compatible since it's an addition). If it's something that's expected to continue changing, I wonder if we should just spread (...) the JSON body into the emitted event. For example:

instance.eventemitter.emit('error', {
    url: nextInQueue.url,
    method: nextInQueue.method,
    ...(json && {...json}) // bringing back of one of Stanley's signature existence-check and spread
});

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 like that. Should I create a story for it?

@esezen esezen requested a review from a team March 24, 2025 20:55
Copy link
Contributor

@stanlp1 stanlp1 left a comment

Choose a reason for hiding this comment

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

@esezen Looks like a couple other tests are failing because we no longer validate item id when beacon=false for click events.

So we aren't returning an error anymore.

Changes here look good but I don't know if we want to wait for backend to finalize their changes, or include these changes in this PR.

Looks like Jimmy created another PR to fix the tests so NVM.

@esezen esezen requested review from jjl014 and stanlp1 April 8, 2025 18:52
Copy link
Contributor

@jjl014 jjl014 left a comment

Choose a reason for hiding this comment

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

Changes look good from what I can tell. Just left a minor comment/question.

Thanks for fixing them! ❤️

Looks like Jimmy created another PR to fix the tests so NVM.

I was not aware of this 😂 I think @stanlp1 might've meant story?

// Response
expect(responseParams).to.have.property('method').to.equal('POST');
expect(responseParams).to.have.property('message').to.equal('conversion type must be one of add_to_wishlist, add_to_cart, like, message, make_offer, read. If you wish to use custom types, please set is_custom_type to true and specify a display_name.');
expect(responseParams).to.have.property('message').to.equal('Invalid parameters');
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know if this is how errors are going to be surfaced moving forward? If so, it shouldn't be too hard to add it as a part of the emitted event (and it should be backwards compatible since it's an addition). If it's something that's expected to continue changing, I wonder if we should just spread (...) the JSON body into the emitted event. For example:

instance.eventemitter.emit('error', {
    url: nextInQueue.url,
    method: nextInQueue.method,
    ...(json && {...json}) // bringing back of one of Stanley's signature existence-check and spread
});

@esezen esezen merged commit 706d308 into master Apr 10, 2025
8 checks passed
@esezen esezen deleted the ci-4285-client-js-update-tests branch April 10, 2025 13:47
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.

3 participants