-
-
Notifications
You must be signed in to change notification settings - Fork 243
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
messages: Add tests for transform_content. #1507
base: main
Are you sure you want to change the base?
Conversation
223c99d
to
9d51e8e
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.
Same as the other PR,
- type annotations
- test ids
Nice work with the noqa exceptions 😉
Nicely done!
I haven't looked into the scope and history behind this PR yet.
But the implementation lgtm.
), | ||
( | ||
""" | ||
<p><a href="#narrow/stream/206-zulip-terminal/topic/announce">https://chat.zulip.zulip/#narrow/stream/206-zulip-terminal/topic/announce</a></p> |
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.
Why not chat.zulip.org? xD
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.
SERVER_URL = "https://chat.zulip.zulip"
is defined on line 28 of test_messages.py
, and I used it when calling transform_content
in the test. Could be changed though, if needed :)
[ | ||
( | ||
""" | ||
<p><a href="https://github.com/zulip/zulip-terminal/pull/1">https://github.com/zulip/zulip-terminal/pull/1</a></p> |
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.
Should we have some link where the text is not the same as the link?
One of the first two?
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.
Done :)
9d51e8e
to
44fd0b4
Compare
This commit introduces tests for the `transform_content` class method, specifically focusing on the `message_links` and `time_mentions`. These enhancements improve the reliability and testing coverage of the `transform_content` method.
44fd0b4
to
6db6378
Compare
Thanks for helping out with the noqa exceptions and for the detailed review! :) @Niloth-p |
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.
Thanks for working on this @rsashank
The test cases considered for each of the functions seem appropriate and enough for testing the respective aspects of the transform_content
function.
@@ -1585,14 +1587,120 @@ def test_keypress_EDIT_MESSAGE( | |||
# fmt: on | |||
], | |||
) | |||
def test_transform_content(self, mocker, raw_html, expected_content): | |||
def test_transform_content(self, raw_html: str, expected_content: Any) -> None: |
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 am not sure if there's a need for this change as we don't usually define data type for the function arguments or the function return variable as we decide what to pass.
You may not keep them in the newly created test function as well.
What does this PR do, and why?
This update PR tests for the transform_content class method for
self.message_links
andself.time_mentions
. The addition of these tests addresses feedback from issue #1455, which pointed out the lack of tests for these aspects.@neiljp said:
External discussion & connections
topic
How did you test this?
Self-review checklist for each commit