-
Notifications
You must be signed in to change notification settings - Fork 189
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
add testing for normal search #2927
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to do the same thing here with the version so it can get the mock stuff from Satellite?
src/api/search/test/query.test.js
Outdated
path: '/posts/post/_search', | ||
}, | ||
() => { | ||
return { statusCode: 503 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mentioned in my tests as well, it's not the statusCode
that is being returned by ElasticSearch that is returning the 503 error.
It's failing because Search is trying to do these two lines here in the return.
It's trying to read hits.total
and hits.hits
, but the hits
object is undefined here because its not being returned by ElasticSearch.
For example, changing it to return { statusCode: 404 }
will also pass this test.
I think we might need to rephrase the description for this test, so its not as misleading
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. I will rephrase the description
src/api/search/jest.setup.js
Outdated
@@ -1 +1 @@ | |||
process.env = { ...process.env, MOCK_ELASTIC: '1' }; | |||
process.env = { ...process.env, MOCK_ELASTIC: '1', LOG_LEVEL: 'error' }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't add the LOG_LEVEL
in my PR, but commented that anyone could do this locally.
I guess its up for discussion if we wanted to keep this or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciated the LOG_LEVEL
hint in your PR. My console was flooded with stuff until I changed that variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I usually do is add a console.log()
to say, we have our logs on silent, but you can change in file x/y/z to error or debug if you want
, and then make this silent
, or it spams too much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea I think that is a good idea. Even in error
mode. It still print a whole bunch of stuff.
efab50c
to
b526a91
Compare
change log mode
b526a91
to
a197dec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff.
Issue This PR Addresses
#2621
Type of Change
Description
Adding tests for the normal search function.
The test has cover all of the normal search function.
Steps to test the PR
pnpm install
pnpm test search
Checklist