Skip to content

Commit

Permalink
ReorgParams
Browse files Browse the repository at this point in the history
Repair-SmallThing -Type ReorgParamTest -First 30
  • Loading branch information
potatoqualitee committed Oct 25, 2024
1 parent eaabf51 commit ebe6660
Show file tree
Hide file tree
Showing 27 changed files with 189 additions and 207 deletions.
9 changes: 8 additions & 1 deletion .aider/aider.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,9 @@ function Repair-Error {
$allObjects = @()

$prompts = @{
ReorgParamTest = "Move the `$expected` parameter list into the 'Should have exactly the number of expected parameters' It block, keeping it between the It block declaration and the `$hasparms` assignment. Do not move the initial `$command` assignment."
ReorgParamTest = "Move the `$expected` parameter list AND the `$TestConfig.CommonParameters part into the 'Should have exactly the number of expected parameters' It block, keeping it between the It block declaration and the `$hasparms` assignment. Do not move the initial `$command` assignment.
If you can't find the `$expected` parameter list, do not make any changes."
}
Write-Verbose "Available prompt types: $($prompts.Keys -join ', ')"

Expand Down Expand Up @@ -321,6 +323,11 @@ function Repair-Error {
end {
Write-Verbose "Starting end block processing"

if ($InputObject.Count -eq 0) {
Write-Verbose "No input objects provided, getting commands from dbatools module"
$allObjects += Get-Command -Module dbatools -Type Function, Cmdlet | Select-Object -First $First -Skip $Skip
}

if (-not $PromptFilePath -and -not $Type) {
Write-Verbose "Neither PromptFilePath nor Type specified"
throw "You must specify either PromptFilePath or Type"
Expand Down
15 changes: 7 additions & 8 deletions tests/Add-DbaAgListener.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ Describe "Add-DbaAgListener" -Tag "UnitTests" {
Context "Parameter validation" {
BeforeAll {
$command = Get-Command Add-DbaAgListener
$expected = $TestConfig.CommonParameters
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$expected = $TestConfig.CommonParameters
$expected += @(
"SqlInstance",
"SqlCredential",
Expand All @@ -24,13 +30,6 @@ Describe "Add-DbaAgListener" -Tag "UnitTests" {
"Confirm",
"WhatIf"
)
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$hasparms = $command.Parameters.Values.Name
Compare-Object -ReferenceObject $expected -DifferenceObject $hasparms | Should -BeNullOrEmpty
}
Expand Down
15 changes: 7 additions & 8 deletions tests/Add-DbaAgReplica.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ Describe "Add-DbaAgReplica" -Tag "UnitTests" {
Context "Parameter validation" {
BeforeAll {
$command = Get-Command Add-DbaAgReplica
$expected = $TestConfig.CommonParameters
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$expected = $TestConfig.CommonParameters
$expected += @(
"SqlInstance",
"SqlCredential",
Expand All @@ -32,13 +38,6 @@ Describe "Add-DbaAgReplica" -Tag "UnitTests" {
"Confirm",
"WhatIf"
)
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$hasparms = $command.Parameters.Values.Name
Compare-Object -ReferenceObject $expected -DifferenceObject $hasparms | Should -BeNullOrEmpty
}
Expand Down
15 changes: 7 additions & 8 deletions tests/Add-DbaComputerCertificate.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ Describe "Add-DbaComputerCertificate" -Tag "UnitTests" {
Context "Parameter validation" {
BeforeAll {
$command = Get-Command Add-DbaComputerCertificate
$expected = $TestConfig.CommonParameters
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$expected = $TestConfig.CommonParameters
$expected += @(
"ComputerName",
"Credential",
Expand All @@ -21,13 +27,6 @@ Describe "Add-DbaComputerCertificate" -Tag "UnitTests" {
"Confirm",
"WhatIf"
)
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$hasparms = $command.Parameters.Values.Name
Compare-Object -ReferenceObject $expected -DifferenceObject $hasparms | Should -BeNullOrEmpty
}
Expand Down
15 changes: 7 additions & 8 deletions tests/Add-DbaDbMirrorMonitor.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@ Describe "Add-DbaDbMirrorMonitor" -Tag "UnitTests" {
Context "Parameter validation" {
BeforeAll {
$command = Get-Command Add-DbaDbMirrorMonitor
$expected = $TestConfig.CommonParameters
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$expected = $TestConfig.CommonParameters
$expected += @(
"SqlInstance",
"SqlCredential",
"EnableException",
"Confirm",
"WhatIf"
)
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$hasparms = $command.Parameters.Values.Name
Compare-Object -ReferenceObject $expected -DifferenceObject $hasparms | Should -BeNullOrEmpty
}
Expand Down
15 changes: 7 additions & 8 deletions tests/Add-DbaDbRoleMember.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ Describe "Add-DbaDbRoleMember" -Tag "UnitTests" {
Context "Parameter validation" {
BeforeAll {
$command = Get-Command Add-DbaDbRoleMember
$expected = $TestConfig.CommonParameters
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$expected = $TestConfig.CommonParameters
$expected += @(
"SqlInstance",
"SqlCredential",
Expand All @@ -19,13 +25,6 @@ Describe "Add-DbaDbRoleMember" -Tag "UnitTests" {
"Confirm",
"WhatIf"
)
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$hasparms = $command.Parameters.Values.Name
Compare-Object -ReferenceObject $expected -DifferenceObject $hasparms | Should -BeNullOrEmpty
}
Expand Down
15 changes: 7 additions & 8 deletions tests/Add-DbaExtendedProperty.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ Describe "Add-DbaExtendedProperty" -Tag "UnitTests" {
Context "Parameter validation" {
BeforeAll {
$command = Get-Command Add-DbaExtendedProperty
$expected = $TestConfig.CommonParameters
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$expected = $TestConfig.CommonParameters
$expected += @(
"SqlInstance",
"SqlCredential",
Expand All @@ -19,13 +25,6 @@ Describe "Add-DbaExtendedProperty" -Tag "UnitTests" {
"Confirm",
"WhatIf"
)
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$hasparms = $command.Parameters.Values.Name
Compare-Object -ReferenceObject $expected -DifferenceObject $hasparms | Should -BeNullOrEmpty
}
Expand Down
15 changes: 7 additions & 8 deletions tests/Add-DbaPfDataCollectorCounter.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ Describe "Add-DbaPfDataCollectorCounter" -Tag "UnitTests" {
Context "Parameter validation" {
BeforeAll {
$command = Get-Command Add-DbaPfDataCollectorCounter
$expected = $TestConfig.CommonParameters
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$expected = $TestConfig.CommonParameters
$expected += @(
"ComputerName",
"Credential",
Expand All @@ -19,13 +25,6 @@ Describe "Add-DbaPfDataCollectorCounter" -Tag "UnitTests" {
"Confirm",
"WhatIf"
)
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$hasparms = $command.Parameters.Values.Name
Compare-Object -ReferenceObject $expected -DifferenceObject $hasparms | Should -BeNullOrEmpty
}
Expand Down
15 changes: 7 additions & 8 deletions tests/Add-DbaRegServer.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ Describe "Add-DbaRegServer" -Tag "UnitTests" {
Context "Parameter validation" {
BeforeAll {
$command = Get-Command Add-DbaRegServer
$expected = $TestConfig.CommonParameters
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$expected = $TestConfig.CommonParameters
$expected += @(
"SqlInstance",
"SqlCredential",
Expand All @@ -25,13 +31,6 @@ Describe "Add-DbaRegServer" -Tag "UnitTests" {
"Confirm",
"WhatIf"
)
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$hasparms = $command.Parameters.Values.Name
Compare-Object -ReferenceObject $expected -DifferenceObject $hasparms | Should -BeNullOrEmpty
}
Expand Down
15 changes: 7 additions & 8 deletions tests/Add-DbaRegServerGroup.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ Describe "Add-DbaRegServerGroup" -Tag "UnitTests" {
Context "Parameter validation" {
BeforeAll {
$command = Get-Command Add-DbaRegServerGroup
$expected = $TestConfig.CommonParameters
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$expected = $TestConfig.CommonParameters
$expected += @(
"SqlInstance",
"SqlCredential",
Expand All @@ -19,13 +25,6 @@ Describe "Add-DbaRegServerGroup" -Tag "UnitTests" {
"Confirm",
"WhatIf"
)
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$hasparms = $command.Parameters.Values.Name
Compare-Object -ReferenceObject $expected -DifferenceObject $hasparms | Should -BeNullOrEmpty
}
Expand Down
15 changes: 7 additions & 8 deletions tests/Add-DbaReplArticle.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ Describe "Add-DbaReplArticle" -Tag "UnitTests" {
Context "Parameter validation" {
BeforeAll {
$command = Get-Command Add-DbaReplArticle
$expected = $TestConfig.CommonParameters
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$expected = $TestConfig.CommonParameters
$expected += @(
"SqlInstance",
"SqlCredential",
Expand All @@ -21,13 +27,6 @@ Describe "Add-DbaReplArticle" -Tag "UnitTests" {
"WhatIf",
"Confirm"
)
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$hasparms = $command.Parameters.Values.Name
Compare-Object -ReferenceObject $expected -DifferenceObject $hasparms | Should -BeNullOrEmpty
}
Expand Down
15 changes: 7 additions & 8 deletions tests/Add-DbaServerRoleMember.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ Describe "Add-DbaServerRoleMember" -Tag "UnitTests" {
Context "Parameter validation" {
BeforeAll {
$command = Get-Command Add-DbaServerRoleMember
$expected = $TestConfig.CommonParameters
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$expected = $TestConfig.CommonParameters
$expected += @(
"SqlInstance",
"SqlCredential",
Expand All @@ -19,13 +25,6 @@ Describe "Add-DbaServerRoleMember" -Tag "UnitTests" {
"Confirm",
"WhatIf"
)
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$hasparms = $command.Parameters.Values.Name
Compare-Object -ReferenceObject $expected -DifferenceObject $hasparms | Should -BeNullOrEmpty
}
Expand Down
15 changes: 7 additions & 8 deletions tests/Backup-DbaComputerCertificate.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ Describe "Backup-DbaComputerCertificate" -Tag "UnitTests" {
Context "Parameter validation" {
BeforeAll {
$command = Get-Command Backup-DbaComputerCertificate
$expected = $TestConfig.CommonParameters
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$expected = $TestConfig.CommonParameters
$expected += @(
"SecurePassword",
"InputObject",
Expand All @@ -18,13 +24,6 @@ Describe "Backup-DbaComputerCertificate" -Tag "UnitTests" {
"Confirm",
"WhatIf"
)
}

It "Has parameter: <_>" -ForEach $expected {
$command | Should -HaveParameter $PSItem
}

It "Should have exactly the number of expected parameters" {
$hasparms = $command.Parameters.Values.Name
Compare-Object -ReferenceObject $expected -DifferenceObject $hasparms | Should -BeNullOrEmpty
}
Expand Down
Loading

0 comments on commit ebe6660

Please sign in to comment.