Skip to content

Improve tests #80

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

Merged
merged 1 commit into from
May 29, 2020
Merged

Improve tests #80

merged 1 commit into from
May 29, 2020

Conversation

eskombro
Copy link
Member

@eskombro eskombro commented May 27, 2020

This is a complete review / refacto of the whole module tests.

Every file and method has been checked, and I did my best to complete the very hard work that had already been done in this test set.

The main goal was to go a little bit deeper in testing every method, and I feel confident that this test set is enough for a guarantee of the quality of code we do and maintain.

Tests have also been classified in directories, corresponding to the package structure, so it is easier to navigate inside of it.

I know this is going to be hard to review, as it is a big fat Pull Request 😄

I want to say congrats to those who have worked on it before, a huge work was done on this before I came (cheers @bidoubiwa)

Closes #53

@eskombro eskombro force-pushed the improve_tests branch 3 times, most recently from 3057ece to 398762d Compare May 27, 2020 13:12
@eskombro eskombro self-assigned this May 28, 2020
@eskombro eskombro marked this pull request as ready for review May 28, 2020 01:48
@eskombro eskombro requested a review from a team May 28, 2020 01:48
Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

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

Thaaaaaaaaanks

@bidoubiwa bidoubiwa self-requested a review May 28, 2020 09:56
@eskombro
Copy link
Member Author

Thanks for the review @curquiza , I included all your changes. I will re-read all the files again to see if there are some simple mistakes that I haven't seen yet!

Copy link
Contributor

@bidoubiwa bidoubiwa left a comment

Choose a reason for hiding this comment

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

Requests overview

  • Could you remove all the in MeiliSearch that are added in some comments? Those are unnecessary
  • Should comment have whitespace before and after the content of the comment? In which case could you do either one or the other?
  • Could you, on the tests you did not move (so I could not suggest modifications), change test an API call to ... to Tests getting/creating ...
  • Some search tests are missing

This is for consistency between every comment and because An API call is not useful information.
I tried to update as many as I could.

Example

  """Tests an API call to get an index's info in MeiliSearch with a wrong UID"""

Becomes

  """Tests getting an index's info with a wrong UID"""

Copy link
Contributor

@bidoubiwa bidoubiwa left a comment

Choose a reason for hiding this comment

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

  • Could you remove all the in MeiliSearch that are added in some comments? Those are unnecessary
  • Should comment have whitespace before and after the content of the comment? In which case could you do either one or the other?

def test_basic_search(self):
"""Tests search with an simple query"""
response = self.index.search('How to Train Your Dragon')
assert isinstance(response, object)
assert response['hits'][0]['id'] == '166428'

Copy link
Contributor

Choose a reason for hiding this comment

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

There should be three additionals tests that tests the following values during a search.

On the query parameters that accepts either an asterix, a string, or an array or string

  • One tests that tries query parameters with a "*" value
  • One tests that tries query parameters with a simple string value
  • One tests that tries query parameters with an array of string as value

Better explaination was made in the PHP sdk: meilisearch/meilisearch-php#19 (comment)

This explanation does not add the tests on a simple string, as it is potentially breaking I would prefer that it is also tested.
The reason I mentioned those tests is because of the hight probability that the codes act in a certain way depending on the type of data it expects. For example the JS library crashed on a simple string before those tests were done.

Copy link
Member Author

Choose a reason for hiding this comment

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

The first two tests were added. The third one actually uncovered a bug, detailed in #85. Test was removed and will be integrated when that issue is solved.

@eskombro eskombro merged commit a816019 into master May 29, 2020
@eskombro eskombro deleted the improve_tests branch May 29, 2020 18:57
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.

Improve tests
3 participants