taskwarrior-flutter icon indicating copy to clipboard operation
taskwarrior-flutter copied to clipboard

Bug: Undefined baseUrl and origin Constants in API Service Test

Open Shweta-281 opened this issue 8 months ago • 0 comments

Describe your issue

The api_service_test.dart file contains unit tests for the Taskwarrior API service. During testing, the baseUrl (API endpoint) and origin (application identifier) constants were referenced but not defined, leading to compilation errors. These constants are critical for constructing the correct API request URL in the fetchTasks function. Without proper definitions, the test suite fails, hindering development and CI/CD pipelines.

Steps to reproduce

  1. Define Constants in the Test File: Add baseUrl and origin directly to the test file as placeholders to resolve compilation issues.

  2. Example: const String baseUrl = 'https://your-api-base-url.com'; const String origin = 'your-application-origin'; This ensures immediate test stability while allowing maintainers to later refactor these values into a shared configuration file.

  3. Future Improvement (Optional): Centralize configuration (e.g., via config.dart or environment variables) to avoid hardcoding values across the codebase. Use mocking for baseUrl and origin in tests to decouple from environment-specific settings.

What was the expected result?

No response

Put here any screenshots or videos (optional)

No response

How can we contact you (optional)

No response

Would you like to work on this issue?

Yes

By submitting this issue, I have confirmed that:

  • [x] I have starred the repo ⭐ and watched 👀 it on GitHub and followed the contribution guidelines.

Shweta-281 avatar Apr 08 '25 06:04 Shweta-281