Skip to content

Conversation

@kyle-nweeia
Copy link
Contributor

Refs #3263.

@kyle-nweeia kyle-nweeia deleted the test-chat-example branch May 14, 2025 21:24
@kyle-nweeia kyle-nweeia restored the test-chat-example branch May 14, 2025 21:25
@kyle-nweeia kyle-nweeia reopened this May 14, 2025
Copy link
Contributor

@darth-raijin darth-raijin left a comment

Choose a reason for hiding this comment

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

Hey! Minor ideas for lifting the quality of the test

username.clear();
check_username(&app_state, &mut username, name);

assert_eq!(username, "");
Copy link
Contributor

Choose a reason for hiding this comment

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

The assertion could be simplified by doing the following

Suggested change
assert_eq!(username, "");
assert!(username.is_empty());

use super::*;

#[tokio::test]
async fn test_check_username() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be cool if the test reflected the behavior you're asserting in the test, maybe something like:
check_username_registers_unique_usernames

assert_eq!(username, name);

username.clear();
check_username(&app_state, &mut username, name);
Copy link
Contributor

Choose a reason for hiding this comment

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

You could also assert on app_state.user_set again, to ensure the HashSet was not changed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants