Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 10, 2025

This pull request updates the file size formatting logic in GitHubFormatter to ensure consistent output with two decimal places for all units, including bytes, and adjusts the related tests to match the new output format. The most important changes are grouped below:

File size formatting improvements:

  • Modified FormatFileSize in GitHubFormatter.ps1 to always display byte values with two decimal places (e.g., "0.00 B" instead of "0 B").

Test updates for new formatting:

  • Updated test cases in GitHubFormatter.Tests.ps1 to expect two-decimal formatting for bytes and adjusted regex patterns to match the new output (e.g., \d+[.,]\d{2}\s{2}B).
  • Refactored the test to directly validate the output of the formatter against the new expected patterns, ensuring the tests accurately reflect the updated formatting logic.
  • Removed outdated comments and redundant test setup to streamline and clarify the test file.

Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Copilot AI changed the title [WIP] 🩹 [Patch]: Adjust GitHubRepository format to show aligned sizes 🩹 [Patch]: Adjust GitHubRepository format to show aligned sizes Sep 10, 2025
Copy link
Member

@MariusStorhaug MariusStorhaug left a comment

Choose a reason for hiding this comment

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

@copilot Please fix.

Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Sep 10, 2025

@copilot Please fix.

Fixed in commit 9f474b1. The alignment issue has been resolved by adding an extra space before the 'B' unit to match the visual width of 2-character units. All tests pass and the size formatting is now properly aligned.

Copy link
Member

@MariusStorhaug MariusStorhaug left a comment

Choose a reason for hiding this comment

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

@copilot Please fix.

…t formatter

Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
… block

Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Sep 10, 2025

@copilot Please fix.

Fixed in commit 20243f9. The test structure has been improved to properly follow Pester best practices with test cases outside the "It" block, proper use of -ForEach parameter, and actual formatter testing with pattern matching. All tests pass and the size formatting alignment is working correctly.

@MariusStorhaug MariusStorhaug marked this pull request as ready for review September 10, 2025 11:22
Copilot AI review requested due to automatic review settings September 10, 2025 11:22
@MariusStorhaug MariusStorhaug requested a review from a team as a code owner September 10, 2025 11:22
Copy link
Contributor

Copilot AI left a 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 improves the formatting consistency of file sizes in the GitHubRepository class by standardizing byte formatting and enhancing test coverage. The changes ensure proper column alignment by formatting all sizes with 2 decimal places and consistent spacing.

  • Standardized byte formatting to include 2 decimal places and extra space before 'B' unit for alignment
  • Refactored tests to use Pester's -ForEach parameter and actually test the formatter logic
  • Optimized test performance by moving class import to BeforeAll block

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/classes/public/GitHubFormatter.ps1 Updated FormatFileSize method to format bytes with 2 decimal places and consistent spacing
tests/GitHubFormatter.Tests.ps1 Enhanced test coverage with proper Pester patterns and actual formatter testing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@MariusStorhaug MariusStorhaug merged commit 8972167 into main Sep 10, 2025
12 of 13 checks passed
@MariusStorhaug MariusStorhaug deleted the copilot/fix-506 branch September 10, 2025 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

🩹 [Patch]: Adjust GitHubRepository format to show aligned sizes

2 participants