Skip to content
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

[Bug]: expectation order of the tags in the tests is incorrect. #839

Open
KostyaTretyak opened this issue Dec 26, 2021 · 2 comments
Open
Assignees
Labels

Comments

@KostyaTretyak
Copy link

KostyaTretyak commented Dec 26, 2021

Relevant scope

Backend specs

Description

In post article body we have in the first place tag training:

"raw":"{\"article\":{\"title\":\"How to train your dragon\", \"description\":\"Ever wonder how?\", \"body\":\"Very carefully.\", \"tagList\":[\"training\", \"dragons\"]}}"

But in tests we expected tag dragons in the first place:

" tests['The first tag is dragons'] = article.tagList[0] === 'dragons';",
" tests['The second tag is training'] = article.tagList[1] === 'training';",

But why? If there is logic in this, it should be described somewhere in the docs. It seems to me that this is a bug.

@KostyaTretyak KostyaTretyak changed the title [Bug]: [Bug]: expectation order of the tags in the tests is incorrect. Dec 26, 2021
@cirosantilli
Copy link
Contributor

I think tag list is just not specified in the spec as it should be.

I assume they are just sorting alphabetically which is a reasonable choice if the tag name is the primary key on the database.

However, I would prefer even better if tags were sorted by descending creation timestamp instead (or maybe updated time, and we can update updated time whenever the tag is applied to an article), as this will create a better user experience for people testing an implementation interactively. You create an article with a new tag, then go back to index, and then easily find your tag without Ctrl + F.

If we go with the timestamp route, I propose that the test should just sort the tags, as results won't be very deterministic when multiple tags are created more or less at the same time with the same post.

Another option would be to sort by most applied tags. This would also be helpful for autocomplete: #784

@geromegrignon
Copy link
Contributor

Indeed, we need to add rules about sorting in specs.
Meanwhile and to avoid breaking existing implementations, I'll create a PR to test tags regardless of their order.
I'm waiting for a review on #490 before (as there is a format change on the JSON file).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants