Use LibraryConstants values in unit tests#1498
Conversation
There was a problem hiding this comment.
Hello @gcatanese, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request updates the unit tests in httpClient.spec.ts to use values from constants/libraryConstants.ts for verifying expectations. This change is necessary because the adyen-library-version is automatically updated during release workflows, and hardcoding the version in the tests would cause them to fail after each release.
Highlights
- Test Improvement: The unit tests now use constants for library name and version, making them more resilient to automated version updates.
- Dependency Update: A new dependency on
LibraryConstantsis introduced in the test file.
Changelog
- src/tests/httpClient.spec.ts
- Imported
LibraryConstantsfrom../constants/libraryConstants. - Replaced hardcoded library name and version strings with
LibraryConstants.LIB_NAMEandLibraryConstants.LIB_VERSIONrespectively in the user agent string. - Updated the expected user agent string to include the application name when it is set.
- Imported
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
In tests, constants reside,
Where versions safely hide.
No more hardcoded strings,
Automated release brings,
A future where tests confide.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
The PR aims to improve the maintainability of unit tests by using constants for library name and version. This is a good approach to avoid hardcoding values and ensure consistency. The changes are straightforward and address the stated problem effectively.
Summary of Findings
- String Concatenation: Consider using template literals for string concatenation to improve readability.
Merge Readiness
The changes are well-structured and improve the maintainability of the tests. The suggestions are minor and can be addressed at the author's discretion. I am unable to approve the pull request, and users should have others review and approve this code before merging.
d122b2c to
24c7a23
Compare
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This PR updates the unit tests in httpClient.spec.ts to use values from constants/libraryConstants for verifying expectations. This is a good change as it ensures that the tests are aligned with the library version, which is updated during release workflows. The changes are straightforward and improve the maintainability of the tests.
Merge Readiness
The pull request is ready to be merged. The changes are straightforward and improve the maintainability of the tests by using constants for the library name and version. The suggestions are minor and can be addressed at the author's discretion. I am unable to directly approve the pull request, and other reviewers should review and approve this code before merging.



PR to update unit tests in
httpClient.spec.ts: use values fromconstants/libraryConstantsto verify expectations.This is necessary as the
adyen-library-versionis updated (incremented) during theReleaseworkflows.