Skip to content

Conversation

@esezen
Copy link
Contributor

@esezen esezen commented Nov 20, 2024

No description provided.

@esezen esezen requested a review from a team November 20, 2024 12:46
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.

Lots of changes in this PR, but things are mostly looking good from what I can tell. I did leave some comments around a few failing tests and some things that we may want to keep around. Lmk what you think. Thanks!

It might also be a good idea to get another review of the changes just in case I missed anything. 👍

});

it('Should respond with a valid response when term and required parameters are provided', (done) => {
it('V2 Should respond with a valid response when term and required parameters are provided', (done) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This test is failing for me due to the server returning a 400. Getting items[0].item_id must be a string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

numResultsViewed = num_results_viewed,
items,
analyticsTags,
resultCount = result_count || items?.length || 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to keep some of these changes, like this one, that we added in previously?

if (items && Array.isArray(items) && items.length !== 0) {
const trimmedItems = items.slice(0, 100);

transformedItems = items;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we keep the trimmage?

selected_filters,
selectedFilters = selected_filters,
url = helpers.getWindowLocation()?.href || 'N/A',
url,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we keep this change as well?

num_results,
result_count,
resultCount = result_count,
numResults = num_results || resultCount,
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm... this doesn't seem to work very well when you end up with:

num_results = 0 and resultCount = undefined

This actually comes out to be undefined and is causing one of the tests to fail: Should respond with a valid response when term, and zero value num_results parameter are provided

I think we can probably use nullish coalescing here and do num_results ?? resultCount. If num_results has a value (even if it's 0) and it's not null, it'll use that value, otherwise it will use resultCount

customer_ids = customerIds,
itemIds,
item_ids = itemIds,
resultCount = numResults || result_count,
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably use nullish coalescing here as well: num_results ?? result_count

url,
section,
analyticsTags,
resultCount = numResults || result_count || items?.length || 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we keep this change as well?

@jjl014 jjl014 requested a review from a team November 22, 2024 01:07
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.

LGTM!

Just left one minor comment/suggestion, but I think this is ready to go. Thank you for working on this!

esezen and others added 2 commits November 25, 2024 13:14
Co-authored-by: Jimmy Li <jimmyli921@gmail.com>
@esezen esezen merged commit 0439558 into master Nov 25, 2024
8 checks passed
@esezen esezen deleted the noci-revert-search-result-loaded branch November 25, 2024 10:21
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