8000 [ADDED] Unit test for `SearchParams` by hossain-khan · Pull Request #415 · hossain-khan/github-stats · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[ADDED] Unit test for SearchParams #415

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
Jun 1, 2025
Merged

[ADDED] Unit test for SearchParams #415

merged 1 commit into from
Jun 1, 2025

Conversation

hossain-khan
Copy link
Owner
@hossain-khan hossain-khan commented Jun 1, 2025

This pull request includes updates to the Kotlin plugin version and introduces comprehensive unit tests for the SearchParams class to ensure proper functionality and encoding of query parameters.

Kotlin Plugin Update:

  • Updated the Kotlin plugin version in .idea/kotlinc.xml from 2.1.0 to 2.1.21 to align with the latest features and improvements.

Unit Tests for SearchParams:

  • Added a new test file SearchParamsTest.kt with the following tests to validate the toQuery method:
    • Ensures correct query formatting with all parameters.
    • Verifies optional parameters (author, reviewer) are excluded when not provided.
    • Confirms proper inclusion of either author or reviewer when only one is provided.
    • Validates correct date range formatting in the generated query.
    • Tests that all query parts are URL-encoded, including special characters.

@hossain-khan hossain-khan self-assigned this Jun 1, 2025
@hossain-khan hossain-khan requested a review from Copilot June 1, 2025 14:32
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a comprehensive suite of unit tests for the SearchParams.toQuery() method to ensure correct query formatting and URL encoding across various parameter combinations.

  • Introduces tests covering all parameter combinations (required only, author only, reviewer only, and both)
  • Verifies date range formatting and full URL encoding behavior
  • Uses a private encode() extension for readability in tests
Files not reviewed (1)
  • .idea/kotlinc.xml: Language not supported
Comments suppressed due to low confidence (2)

src/test/kotlin/dev/hossain/githubstats/service/SearchParamsTest.kt:6

  • [nitpick] Consider using a single assertion library (e.g., org.junit.jupiter.api.Assertions.assertTrue) instead of mixing JUnit and kotlin.test in one class for consistency.
import kotlin.test.assertTrue

src/test/kotlin/dev/hossain/githubstats/service/SearchParamsTest.kt:27

  • [nitpick] The tests build expected queries via repetitive string concatenation and inline encode() calls. Extract the parts into a list and use joinToString("+") after mapping encode() to reduce duplication and improve readability.
"${\"is:closed\".encode()}+" +

@hossain-khan hossain-khan enabled auto-merge June 1, 2025 14:33
@hossain-khan hossain-khan merged commit f44d85f into main Jun 1, 2025
1 check passed
@hossain-khan hossain-khan deleted the search-param-test branch June 1, 2025 14:33
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.

1 participant
0