Skip to content

Conversation

@yasserahmed10
Copy link
Contributor

This pull request introduces several new test cases and updates to improve test coverage and maintainability across the codebase. The changes include adding unit tests for subtask-related use cases, renaming a test class for consistency, and enhancing the MapperKtTest to cover additional scenarios.

New test cases for subtask-related use cases:

  • Added CreateSubTaskUseCaseTest to verify the creation of subtasks, including success, failure, and validation of the passed SubTask object. (src/test/kotlin/domain/usecases/sub_task/CreateSubTaskUseCaseTest.kt)
  • Added DeleteSubTaskUseCaseTest to test the deletion of subtasks, ensuring correct behavior when the repository succeeds or fails, and validating the passed subtask ID. (src/test/kotlin/domain/usecases/sub_task/DeleteSubTaskUseCaseTest.kt)
  • Added GetSubTasksByTaskIdUseCaseTest to test fetching subtasks by task ID, covering scenarios where the repository returns data, no data, and validating the task ID passed to the repository. (src/test/kotlin/domain/usecases/sub_task/GetSubTasksByTaskIdUseCaseTest.kt)
  • Added UpdateSubTaskUseCaseTest to validate the update functionality for subtasks, including success, failure, and ensuring the correct SubTask object is passed to the repository. (src/test/kotlin/domain/usecases/sub_task/UpdateSubTaskUseCaseTest.kt)

Enhancements to existing tests:

  • Enhanced MapperKtTest by adding tests for converting a String to a SubTask and converting a TaskDto to a Task with subtasks, improving coverage for mapping logic. (src/test/kotlin/data/mappers/MapperKtTest.kt)

Test class renaming for consistency:

  • Renamed TaskStateDataSourceImplTest to TaskStateRepositoryImplTest to align with the updated naming conventions of the repository layer. (src/test/kotlin/data/repositories/TaskStateRepositoryImplTest.kt)

@yasserahmed10 yasserahmed10 self-assigned this May 18, 2025
@yasserahmed10 yasserahmed10 added enhancement New feature or request test cases Work on Testcases labels May 18, 2025
@github-actions
Copy link

Test Results

355 tests  +14   318 ✅ +14   10s ⏱️ ±0s
 66 suites + 4     0 💤 ± 0 
 66 files   + 4    37 ❌ ± 0 

For more details on these failures, see this check.

Results for commit 521bc3f. ± Comparison against base commit 6ee1efc.

This pull request removes 19 and adds 32 tests. Note that renamed tests count towards both.

data.repositories.TaskStateDataSourceImplTest ‑ addTask should store task in repository()
data.repositories.TaskStateDataSourceImplTest ‑ addTask should throw TaskIsExist when task with same ID already exists()
data.repositories.TaskStateDataSourceImplTest ‑ deleteTask should remove task from repository()
data.repositories.TaskStateDataSourceImplTest ‑ deleteTask should throw TaskIsNotFoundException when task does not exist()
data.repositories.TaskStateDataSourceImplTest ‑ editTask should modify existing task()
data.repositories.TaskStateDataSourceImplTest ‑ editTask should throw TaskIsNotFoundException when task does not exist()
data.repositories.TaskStateDataSourceImplTest ‑ editing task should not affect other tasks()
data.repositories.TaskStateDataSourceImplTest ‑ getAllTasks should return all tasks()
data.repositories.TaskStateDataSourceImplTest ‑ getTaskById should find correct task when multiple tasks have same project ID()
…
data.mappers.MapperKtTest ‑ test String to SubTask conversion()
data.mappers.MapperKtTest ‑ test TaskDto to Task conversion with subTasks()
data.repositories.TaskStateRepositoryImplTest ‑ addTask should store task in repository()
data.repositories.TaskStateRepositoryImplTest ‑ addTask should throw TaskIsExist when task with same ID already exists()
data.repositories.TaskStateRepositoryImplTest ‑ deleteTask should remove task from repository()
data.repositories.TaskStateRepositoryImplTest ‑ deleteTask should throw TaskIsNotFoundException when task does not exist()
data.repositories.TaskStateRepositoryImplTest ‑ editTask should modify existing task()
data.repositories.TaskStateRepositoryImplTest ‑ editTask should throw TaskIsNotFoundException when task does not exist()
data.repositories.TaskStateRepositoryImplTest ‑ editing task should not affect other tasks()
data.repositories.TaskStateRepositoryImplTest ‑ getAllTasks should return all tasks()
…

@github-actions
Copy link

❌ Test or Coverage checks failed! Please check the workflow run for details.

@github-actions
Copy link

Qodana Community for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked

View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/qodana-action@v2024.3.4
        with:
          upload-result: true
Contact Qodana team

Contact us at qodana-support@jetbrains.com

Copy link
Member

@Ahmedsayed0895 Ahmedsayed0895 left a comment

Choose a reason for hiding this comment

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

Good job

@yasserahmed10 yasserahmed10 requested review from aabukmail and removed request for baraa0abd May 18, 2025 12:24
@yasserahmed10 yasserahmed10 merged commit aef0ffd into development May 18, 2025
3 of 6 checks passed
@yasserahmed10 yasserahmed10 deleted the improve-testing branch May 18, 2025 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request test cases Work on Testcases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants