-
Notifications
You must be signed in to change notification settings - Fork 0
Add tests for URL helpers and localized formatting #24
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive test coverage for URL helpers and localized formatting utilities, while also fixing an obsolete logging API call. The changes enhance test coverage for URL query item builders, temporary directory generation, and number formatting functionality.
- Added test suites for URL query item construction from arrays and dictionaries
- Added tests for URL temporary directory uniqueness and localized number formatting
- Updated deprecated logging API call and improved number formatter configuration
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/WrkstrmNetworkingTests/WrkstrmNetworkingTests.swift | Updates deprecated logging API call |
| Tests/WrkstrmFoundationTests/URLTempDirectoryTests.swift | Adds tests for URL temporary directory uniqueness |
| Tests/WrkstrmFoundationTests/URLQueryItemTests.swift | Adds tests for URL query item builders with arrays and dictionaries |
| Tests/WrkstrmFoundationTests/LocalizedValuesTests.swift | Adds tests for localized integer, double, and currency formatting |
| Sources/WrkstrmFoundation/Extensions/NumberFormatter+Localize.swift | Improves number formatter configuration and documentation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
| let previous = NumberFormatter.dollar.locale | ||
| NumberFormatter.dollar.locale = Locale(identifier: "en_US_POSIX") | ||
| defer { NumberFormatter.dollar.locale = previous } | ||
| #expect(1234.5.dollarString() == "$\u{00a0}1,234.50") |
Copilot
AI
Aug 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The Unicode escape sequence \u{00a0} (non-breaking space) makes the test harder to read and maintain. Consider using a more explicit approach like defining a constant or using the actual character.
| #expect(1234.5.dollarString() == "$\u{00a0}1,234.50") | |
| #expect(1234.5.dollarString() == "$\(NBSP)1,234.50") |
| formatter.numberStyle = .decimal | ||
| formatter.minimumFractionDigits = 2 | ||
| formatter.maximumFractionDigits = 2 | ||
| formatter.roundingIncrement = 0.01 |
Copilot
AI
Aug 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting roundingIncrement to 0.01 may not be appropriate for all currencies. Some currencies have different decimal places (e.g., Japanese Yen has 0, some Middle Eastern currencies have 3). Consider making this configurable or using the currency's default decimal places.
| formatter.roundingIncrement = 0.01 | |
| formatter.roundingIncrement = pow(10, -Double(formatter.maximumFractionDigits)) |
Summary
Testing
swift testswift build --target WrkstrmFoundationTestshttps://chatgpt.com/codex/tasks/task_e_689c0747df6c833389166144f5960fd7