-
Notifications
You must be signed in to change notification settings - Fork 253
Bug 1949126 - Improve the Rust based search engine selector tests Part 1 #7126
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
base: main
Are you sure you want to change the base?
Bug 1949126 - Improve the Rust based search engine selector tests Part 1 #7126
Conversation
|
This is the general gist of the structure I've been creating. Right now, the builder methods are not being called:
But I did test them out to create different custom types of full or minimal engine records. |
Standard8
left a comment
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.
This is the general gist of the structure I've been creating. I'm thinking of making builder methods for the
SearchEngineDefinitionas well later.
Thank you, I like the approach here.
I think the one improvement I'd suggest is to always require an identifier to be passed in for the engines. For example the test would read as:
test_helpers::EngineRecord::full().build(),
test_helpers::EngineRecord::minimal().build(),
Although we can probably assume in that order they would be 1 and 2, if I change the order do the ids change as well? Hence, I think it would be better to pass the identifier in - we require this for the existing JS test utils, so I think its fine to reflect that here.
Marking as request changes, so I'll get notified/a signal when there's updates.
d6f4c3c to
097f1e4
Compare
|
I changed all tests in I will put up a different PR for the other tests in |
Standard8
left a comment
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.
Thank you, this is looking very nice and a big improvement in readability & code size.
A couple of thoughts in-line.
| #[cfg(test)] | ||
| mod test_helpers; |
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 would suggest putting this at the end of the file since it is test related.
| .with_status(200) | ||
| .with_header("content-type", "application/json") | ||
| .with_header("etag", "\"1000\"") | ||
| .create() | ||
| } | ||
|
|
||
| fn response_body() -> String { |
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'm not sure we should move these response_body* functions out to the helper - as far as I know they'll only be used in this test. Whilst it does separate things out, I'm not sure they are really helpers.
Though I think we could cut down the lines of code by using the EngineRecord::build etc.
Pull Request checklist
[ci full]to the PR title.