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

[Sweep Rules] Add unit test for RemoveRepeatedElementsInList function #1223

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

sweep-ai[bot]
Copy link
Contributor

@sweep-ai sweep-ai bot commented Oct 13, 2023

PR Feedback (click)

  • 👍 Sweep Did Well
  • 👎 Sweep Needs Improvement

I created this PR to address this rule:

" All new business logic should have corresponding unit tests in the tests/ directory."

Description

This PR adds a unit test for the RemoveRepeatedElementsInList function in the pkg/common/db/cache/user.go file. The function is a utility function for removing duplicate elements from a list. The unit test covers different scenarios and edge cases to ensure the function behaves correctly.

Summary of Changes

  • Created a new test file tests/user_test.go to add the unit test for the RemoveRepeatedElementsInList function.
  • Imported the testing package and the package containing the RemoveRepeatedElementsInList function.
  • Defined a new function TestRemoveRepeatedElementsInList in the test file.
  • Added multiple test cases to cover scenarios with no duplicates, all duplicates, and some duplicates.
  • Included edge cases with an empty list and a list with a single element.
  • Compared the actual output of the RemoveRepeatedElementsInList function with the expected output for each test case.
  • The unit test ensures the correctness of the RemoveRepeatedElementsInList function.

Please review and merge this PR to include the necessary unit test for the new business logic.

@sweep-ai sweep-ai bot requested a review from cubxxw as a code owner October 13, 2023 14:37
@sweep-ai
Copy link
Contributor Author

sweep-ai bot commented Oct 13, 2023

Rollback Files For Sweep

  • Rollback changes to tests/user_test.go

@sweep-ai sweep-ai bot added the sweep label Oct 13, 2023
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 13, 2023
@sweep-ai sweep-ai bot temporarily deployed to openim October 13, 2023 14:37 Inactive
@sweep-ai sweep-ai bot temporarily deployed to openim October 13, 2023 14:37 Inactive
@sweep-ai sweep-ai bot temporarily deployed to openim October 13, 2023 14:37 Inactive
@sweep-ai sweep-ai bot temporarily deployed to openim October 13, 2023 14:37 Inactive
@sweep-ai sweep-ai bot temporarily deployed to openim October 13, 2023 14:37 Inactive
@sweep-ai sweep-ai bot temporarily deployed to openim October 13, 2023 14:37 Inactive
@sweep-ai sweep-ai bot temporarily deployed to openim October 13, 2023 14:37 Inactive
@cubxxw cubxxw enabled auto-merge October 18, 2023 13:38
@cubxxw cubxxw added this pull request to the merge queue Oct 18, 2023
Merged via the queue into main with commit 1c1f2a9 Oct 18, 2023
@cubxxw cubxxw deleted the sweep/add-unit-test-remove-repeated-elements_1 branch October 18, 2023 13:39
@github-actions github-actions bot added this to the v3.1 milestone Oct 18, 2023
@openimsdk openimsdk locked and limited conversation to collaborators Oct 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants