Skip to content

Bug: Undefined baseUrl and origin Constants in API Service Test #479

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

Open
1 task done
Shweta-281 opened this issue Apr 8, 2025 · 0 comments · May be fixed by #480
Open
1 task done

Bug: Undefined baseUrl and origin Constants in API Service Test #479

Shweta-281 opened this issue Apr 8, 2025 · 0 comments · May be fixed by #480
Labels
bug Something isn't working

Comments

@Shweta-281
Copy link

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:

  • I have starred the repo ⭐ and watched 👀 it on GitHub and followed the contribution guidelines.
@Shweta-281 Shweta-281 added the bug Something isn't working label Apr 8, 2025
@Shweta-281 Shweta-281 linked a pull request Apr 8, 2025 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant