Skip to content

Refactor and enhance Pester tests batch #9760

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
wants to merge 19 commits into
base: development
Choose a base branch
from
Open

Conversation

potatoqualitee
Copy link
Member

Refactored Pester test files for several Find-* and Export-DbaXESessionTemplate commands to use param blocks, improved parameter validation, and modernized test structure. Added BeforeAll/AfterAll setup and teardown, improved assertions, and enhanced test coverage and clarity for integration and unit tests.

Refactored Pester test files for several Find-* and Export-DbaXESessionTemplate commands to use param blocks, improved parameter validation, and modernized test structure. Added BeforeAll/AfterAll setup and teardown, improved assertions, and enhanced test coverage and clarity for integration and unit tests.
Updated Invoke-DbatoolsFormatter to use custom PSSA settings that preserve manually aligned hashtables and assignment operators. The script now only writes files if formatting changes are detected, reducing unnecessary file writes.
Added checks to skip directories and non-PowerShell files, improved error handling for file read/write operations, and ensured only valid content is processed. These changes enhance robustness and prevent errors when processing invalid or unreadable files.
Enhances the formatter to compare processed, formatted content rather than raw content, ensuring that only meaningful formatting changes trigger file writes. Also applies CBH (Comment-Based Help) fixes and whitespace normalization to both the original and formatted content for accurate comparison.
Simplifies the formatter by removing custom alignment-preserving settings and redundant code. Now uses a placeholder approach to preserve aligned assignments, streamlines file type checks, and only writes files if actual formatting changes are detected. Improves maintainability and reliability of the formatting process.
Enhanced Invoke-DbatoolsFormatter to display progress when formatting multiple files, including status updates for each file, error handling, and a summary of processed and updated files. This improves user feedback during batch operations.
This commit corrects minor whitespace and formatting inconsistencies in several test files, including removal of trailing spaces and standardizing indentation. No functional changes were made.
This commit standardizes whitespace, indentation, and formatting across multiple test files for consistency. No functional changes were made; only formatting and minor style adjustments were applied.
Refactored test scripts for Find-DbaAgentJob, Find-DbaOrphanedFile, Format-DbaBackupInformation, and Get-DbaAgentJobHistory to improve readability, consistency, and maintainability. Changes include using splatting for parameters, removing unnecessary global variables and Write-Host statements, updating variable naming for clarity, consolidating repeated code, and aligning test assertions for accuracy. Also updated context descriptions and streamlined setup/cleanup logic in integration tests.
Introduces a new 'Pattern' parameter to Repair-PullRequestTest, allowing users to filter test files by name using wildcards. Updates logic to apply this filter when processing failed tests and enhances verbose output to reflect the applied pattern.
Standardized variable naming, improved parameter usage, and removed redundant or unnecessary code in test scripts. Updated test assertions for clarity and consistency, and simplified setup/teardown logic. These changes improve readability and maintainability of the test suite.
Refactored multiple test scripts to remove parameter blocks and redundant setup, streamline parameter validation, and use more concise and modern Pester syntax. The changes improve readability and maintainability by reducing boilerplate and making test logic clearer.
Updated Pester test scripts for Find-DbaAgentJob, Get-DbaAgentJob, Get-DbaAgentJobHistory, and Format-DbaBackupInformation to use parameterized headers, improved parameter validation, and consistent formatting. Enhanced test reliability and maintainability by using BeforeAll/AfterAll blocks, explicit parameter lists, and modern Pester syntax. Improved code readability and alignment with current dbatools testing standards.
Find-DbaAgentJob, Get-DbaAgentJobHistory, Get-DbaAgentLog, and New-DbaDbTransfer
@potatoqualitee
Copy link
Member Author

Find-DbaAgentJob, Get-DbaAgentJobHistory, Get-DbaAgentLog, and New-DbaDbTransfer can't be automatically converted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant