Skip to content

Commit

Permalink
remove type check
Browse files Browse the repository at this point in the history
  • Loading branch information
potatoqualitee committed Oct 19, 2024
1 parent 1386958 commit adc6a8b
Show file tree
Hide file tree
Showing 707 changed files with 6,219 additions and 6,247 deletions.
13 changes: 12 additions & 1 deletion .aider/prompts/fix-parms.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# loop through all files in the tests directory that matches HaveParameter
<# loop through all files in the tests directory that matches HaveParameter
$tests = Get-ChildItem -Path /workspace/tests -Filter *.Tests.ps1
$prompt = "When testing HaveParameter, we should have used type full names and we used type short names.Consult types.md and apply the appropriate replacements. Do not remove any arrays ([]), just replace the type names."
Expand All @@ -8,3 +8,14 @@ foreach ($test in $tests) {
Write-Host "Processing $test"
aider --message "$prompt" --file $test.FullName --model azure/gpt-4o-mini --no-stream --cache-prompts --read /workspace/.aider/prompts/types.md
}
#>

$tests = Get-ChildItem -Path /workspace/tests -Filter *.Tests.ps1

$prompt = "This is a Pester v5 test suite. 1. Remove -Type test in HaveParameter tests. 2. Remove -Mandatory test in HaveParameter test. 2. Remove all -Mandatory:`$false from the HaveParameter test."


foreach ($test in $tests) {
Write-Host "Processing $test"
aider --message "$prompt" --file $test.FullName --model azure/gpt-4o-mini --no-stream
}
44 changes: 22 additions & 22 deletions tests/Add-DbaAgDatabase.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,41 @@ Describe "Add-DbaAgDatabase" {
BeforeAll {
$CommandUnderTest = Get-Command Add-DbaAgDatabase
}
It "Should have SqlInstance as a non-mandatory parameter of type Dataplat.Dbatools.Parameter.DbaInstanceParameter" {
$CommandUnderTest | Should -HaveParameter SqlInstance -Type Dataplat.Dbatools.Parameter.DbaInstanceParameter -Mandatory:$false
It "Should have SqlInstance as a non-mandatory parameter" {
$CommandUnderTest | Should -HaveParameter SqlInstance
}
It "Should have SqlCredential as a non-mandatory parameter of type System.Management.Automation.PSCredential" {
$CommandUnderTest | Should -HaveParameter SqlCredential -Type System.Management.Automation.PSCredential -Mandatory:$false
It "Should have SqlCredential as a non-mandatory parameter" {
$CommandUnderTest | Should -HaveParameter SqlCredential
}
It "Should have AvailabilityGroup as a non-mandatory parameter of type System.String" {
$CommandUnderTest | Should -HaveParameter AvailabilityGroup -Type System.String -Mandatory:$false
It "Should have AvailabilityGroup as a non-mandatory parameter" {
$CommandUnderTest | Should -HaveParameter AvailabilityGroup
}
It "Should have Database as a non-mandatory parameter of type System.String[]" {
$CommandUnderTest | Should -HaveParameter Database -Type System.String[] -Mandatory:$false
It "Should have Database as a non-mandatory parameter" {
$CommandUnderTest | Should -HaveParameter Database
}
It "Should have Secondary as a non-mandatory parameter of type Dataplat.Dbatools.Parameter.DbaInstanceParameter[]" {
$CommandUnderTest | Should -HaveParameter Secondary -Type Dataplat.Dbatools.Parameter.DbaInstanceParameter[] -Mandatory:$false
It "Should have Secondary as a non-mandatory parameter" {
$CommandUnderTest | Should -HaveParameter Secondary
}
It "Should have SecondarySqlCredential as a non-mandatory parameter of type System.Management.Automation.PSCredential" {
$CommandUnderTest | Should -HaveParameter SecondarySqlCredential -Type System.Management.Automation.PSCredential -Mandatory:$false
It "Should have SecondarySqlCredential as a non-mandatory parameter" {
$CommandUnderTest | Should -HaveParameter SecondarySqlCredential
}
It "Should have InputObject as a non-mandatory parameter of type Microsoft.SqlServer.Management.Smo.Database[]" {
$CommandUnderTest | Should -HaveParameter InputObject -Type Microsoft.SqlServer.Management.Smo.Database[] -Mandatory:$false
It "Should have InputObject as a non-mandatory parameter" {
$CommandUnderTest | Should -HaveParameter InputObject
}
It "Should have SeedingMode as a non-mandatory parameter of type System.String" {
$CommandUnderTest | Should -HaveParameter SeedingMode -Type System.String -Mandatory:$false
It "Should have SeedingMode as a non-mandatory parameter" {
$CommandUnderTest | Should -HaveParameter SeedingMode
}
It "Should have SharedPath as a non-mandatory parameter of type System.String" {
$CommandUnderTest | Should -HaveParameter SharedPath -Type System.String -Mandatory:$false
It "Should have SharedPath as a non-mandatory parameter" {
$CommandUnderTest | Should -HaveParameter SharedPath
}
It "Should have UseLastBackup as a non-mandatory switch parameter" {
$CommandUnderTest | Should -HaveParameter UseLastBackup -Type System.Management.Automation.Switch -Mandatory:$false
$CommandUnderTest | Should -HaveParameter UseLastBackup
}
It "Should have AdvancedBackupParams as a non-mandatory parameter of type System.Collections.Hashtable" {
$CommandUnderTest | Should -HaveParameter AdvancedBackupParams -Type System.Collections.Hashtable -Mandatory:$false
It "Should have AdvancedBackupParams as a non-mandatory parameter" {
$CommandUnderTest | Should -HaveParameter AdvancedBackupParams
}
It "Should have EnableException as a non-mandatory switch parameter" {
$CommandUnderTest | Should -HaveParameter EnableException -Type System.Management.Automation.Switch -Mandatory:$false
$CommandUnderTest | Should -HaveParameter EnableException
}
}

Expand Down
42 changes: 21 additions & 21 deletions tests/Add-DbaAgListener.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,41 @@ Describe "Add-DbaAgListener" {
BeforeAll {
$CommandUnderTest = Get-Command Add-DbaAgListener
}
It "Should have SqlInstance as a non-mandatory parameter of type Dataplat.Dbatools.Parameter.DbaInstanceParameter[]" {
$CommandUnderTest | Should -HaveParameter SqlInstance -Type Dataplat.Dbatools.Parameter.DbaInstanceParameter[] -Mandatory:$false
It "Should have SqlInstance as a non-mandatory parameter" {
$CommandUnderTest | Should -HaveParameter SqlInstance
}
It "Should have SqlCredential as a non-mandatory parameter of type System.Management.Automation.PSCredential" {
$CommandUnderTest | Should -HaveParameter SqlCredential -Type System.Management.Automation.PSCredential -Mandatory:$false
It "Should have SqlCredential as a non-mandatory parameter" {
$CommandUnderTest | Should -HaveParameter SqlCredential
}
It "Should have AvailabilityGroup as a non-mandatory parameter of type System.String[]" {
$CommandUnderTest | Should -HaveParameter AvailabilityGroup -Type System.String[] -Mandatory:$false
It "Should have AvailabilityGroup as a non-mandatory parameter" {
$CommandUnderTest | Should -HaveParameter AvailabilityGroup
}
It "Should have Name as a non-mandatory parameter of type System.String" {
$CommandUnderTest | Should -HaveParameter Name -Type System.String -Mandatory:$false
It "Should have Name as a non-mandatory parameter" {
$CommandUnderTest | Should -HaveParameter Name
}
It "Should have IPAddress as a non-mandatory parameter of type System.Net.IPAddress[]" {
$CommandUnderTest | Should -HaveParameter IPAddress -Type System.Net.IPAddress[] -Mandatory:$false
It "Should have IPAddress as a non-mandatory parameter" {
$CommandUnderTest | Should -HaveParameter IPAddress
}
It "Should have SubnetIP as a non-mandatory parameter of type System.Net.IPAddress[]" {
$CommandUnderTest | Should -HaveParameter SubnetIP -Type System.Net.IPAddress[] -Mandatory:$false
It "Should have SubnetIP as a non-mandatory parameter" {
$CommandUnderTest | Should -HaveParameter SubnetIP
}
It "Should have SubnetMask as a non-mandatory parameter of type System.Net.IPAddress[]" {
$CommandUnderTest | Should -HaveParameter SubnetMask -Type System.Net.IPAddress[] -Mandatory:$false
It "Should have SubnetMask as a non-mandatory parameter" {
$CommandUnderTest | Should -HaveParameter SubnetMask
}
It "Should have Port as a non-mandatory parameter of type System.Int32" {
$CommandUnderTest | Should -HaveParameter Port -Type System.Int32 -Mandatory:$false
It "Should have Port as a non-mandatory parameter" {
$CommandUnderTest | Should -HaveParameter Port
}
It "Should have Dhcp as a non-mandatory switch parameter" {
$CommandUnderTest | Should -HaveParameter Dhcp -Type System.Management.Automation.SwitchParameter -Mandatory:$false
$CommandUnderTest | Should -HaveParameter Dhcp
}
It "Should have Passthru as a non-mandatory switch parameter" {
$CommandUnderTest | Should -HaveParameter Passthru -Type System.Management.Automation.SwitchParameter -Mandatory:$false
$CommandUnderTest | Should -HaveParameter Passthru
}
It "Should have InputObject as a non-mandatory parameter of type Microsoft.SqlServer.Management.Smo.AvailabilityGroup[]" {
$CommandUnderTest | Should -HaveParameter InputObject -Type Microsoft.SqlServer.Management.Smo.AvailabilityGroup[] -Mandatory:$false
It "Should have InputObject as a non-mandatory parameter" {
$CommandUnderTest | Should -HaveParameter InputObject
}
It "Should have EnableException as a non-mandatory switch parameter" {
$CommandUnderTest | Should -HaveParameter EnableException -Type System.Management.Automation.SwitchParameter -Mandatory:$false
$CommandUnderTest | Should -HaveParameter EnableException
}
}

Expand Down
40 changes: 20 additions & 20 deletions tests/Add-DbaAgReplica.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,64 +11,64 @@ Describe "Add-DbaAgReplica" {
$CommandUnderTest = Get-Command Add-DbaAgReplica
}
It "Should have SqlInstance parameter" {
$CommandUnderTest | Should -HaveParameter SqlInstance -Type Dataplat.Dbatools.Parameter.DbaInstanceParameter[]
$CommandUnderTest | Should -HaveParameter SqlInstance
}
It "Should have SqlCredential parameter" {
$CommandUnderTest | Should -HaveParameter SqlCredential -Type System.Management.Automation.PSCredential
$CommandUnderTest | Should -HaveParameter SqlCredential
}
It "Should have Name parameter" {
$CommandUnderTest | Should -HaveParameter Name -Type System.String
$CommandUnderTest | Should -HaveParameter Name
}
It "Should have ClusterType parameter" {
$CommandUnderTest | Should -HaveParameter ClusterType -Type System.String
$CommandUnderTest | Should -HaveParameter ClusterType
}
It "Should have AvailabilityMode parameter" {
$CommandUnderTest | Should -HaveParameter AvailabilityMode -Type System.String
$CommandUnderTest | Should -HaveParameter AvailabilityMode
}
It "Should have FailoverMode parameter" {
$CommandUnderTest | Should -HaveParameter FailoverMode -Type System.String
$CommandUnderTest | Should -HaveParameter FailoverMode
}
It "Should have BackupPriority parameter" {
$CommandUnderTest | Should -HaveParameter BackupPriority -Type System.Int32
$CommandUnderTest | Should -HaveParameter BackupPriority
}
It "Should have ConnectionModeInPrimaryRole parameter" {
$CommandUnderTest | Should -HaveParameter ConnectionModeInPrimaryRole -Type System.String
$CommandUnderTest | Should -HaveParameter ConnectionModeInPrimaryRole
}
It "Should have ConnectionModeInSecondaryRole parameter" {
$CommandUnderTest | Should -HaveParameter ConnectionModeInSecondaryRole -Type System.String
$CommandUnderTest | Should -HaveParameter ConnectionModeInSecondaryRole
}
It "Should have SeedingMode parameter" {
$CommandUnderTest | Should -HaveParameter SeedingMode -Type System.String
$CommandUnderTest | Should -HaveParameter SeedingMode
}
It "Should have Endpoint parameter" {
$CommandUnderTest | Should -HaveParameter Endpoint -Type System.String
$CommandUnderTest | Should -HaveParameter Endpoint
}
It "Should have EndpointUrl parameter" {
$CommandUnderTest | Should -HaveParameter EndpointUrl -Type System.String[]
$CommandUnderTest | Should -HaveParameter EndpointUrl
}
It "Should have Passthru parameter" {
$CommandUnderTest | Should -HaveParameter Passthru -Type System.Management.Automation.SwitchParameter
$CommandUnderTest | Should -HaveParameter Passthru
}
It "Should have ReadOnlyRoutingList parameter" {
$CommandUnderTest | Should -HaveParameter ReadOnlyRoutingList -Type System.String[]
$CommandUnderTest | Should -HaveParameter ReadOnlyRoutingList
}
It "Should have ReadonlyRoutingConnectionUrl parameter" {
$CommandUnderTest | Should -HaveParameter ReadonlyRoutingConnectionUrl -Type System.String
$CommandUnderTest | Should -HaveParameter ReadonlyRoutingConnectionUrl
}
It "Should have Certificate parameter" {
$CommandUnderTest | Should -HaveParameter Certificate -Type System.String
$CommandUnderTest | Should -HaveParameter Certificate
}
It "Should have ConfigureXESession parameter" {
$CommandUnderTest | Should -HaveParameter ConfigureXESession -Type System.Management.Automation.SwitchParameter
$CommandUnderTest | Should -HaveParameter ConfigureXESession
}
It "Should have SessionTimeout parameter" {
$CommandUnderTest | Should -HaveParameter SessionTimeout -Type System.Int32
$CommandUnderTest | Should -HaveParameter SessionTimeout
}
It "Should have InputObject parameter" {
$CommandUnderTest | Should -HaveParameter InputObject -Type Microsoft.SqlServer.Management.Smo.AvailabilityGroup
$CommandUnderTest | Should -HaveParameter InputObject
}
It "Should have EnableException parameter" {
$CommandUnderTest | Should -HaveParameter EnableException -Type System.Management.Automation.SwitchParameter
$CommandUnderTest | Should -HaveParameter EnableException
}
}

Expand Down
18 changes: 9 additions & 9 deletions tests/Add-DbaComputerCertificate.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,31 @@ Describe "Add-DbaComputerCertificate" {
$CommandUnderTest = Get-Command Add-DbaComputerCertificate
}
It "Should have ComputerName as a parameter" {
$CommandUnderTest | Should -HaveParameter ComputerName -Type Dataplat.Dbatools.Parameter.DbaInstanceParameter[]
$CommandUnderTest | Should -HaveParameter ComputerName
}
It "Should have Credential as a parameter" {
$CommandUnderTest | Should -HaveParameter Credential -Type System.Management.Automation.PSCredential
$CommandUnderTest | Should -HaveParameter Credential
}
It "Should have SecurePassword as a parameter" {
$CommandUnderTest | Should -HaveParameter SecurePassword -Type System.Security.SecureString
$CommandUnderTest | Should -HaveParameter SecurePassword
}
It "Should have Certificate as a parameter" {
$CommandUnderTest | Should -HaveParameter Certificate -Type System.Security.Cryptography.X509Certificates.X509Certificate2[]
$CommandUnderTest | Should -HaveParameter Certificate
}
It "Should have Path as a parameter" {
$CommandUnderTest | Should -HaveParameter Path -Type System.String
$CommandUnderTest | Should -HaveParameter Path
}
It "Should have Store as a parameter" {
$CommandUnderTest | Should -HaveParameter Store -Type System.String
$CommandUnderTest | Should -HaveParameter Store
}
It "Should have Folder as a parameter" {
$CommandUnderTest | Should -HaveParameter Folder -Type System.String
$CommandUnderTest | Should -HaveParameter Folder
}
It "Should have Flag as a parameter" {
$CommandUnderTest | Should -HaveParameter Flag -Type System.String[]
$CommandUnderTest | Should -HaveParameter Flag
}
It "Should have EnableException as a parameter" {
$CommandUnderTest | Should -HaveParameter EnableException -Type System.Management.Automation.SwitchParameter
$CommandUnderTest | Should -HaveParameter EnableException
}
}

Expand Down
10 changes: 5 additions & 5 deletions tests/Add-DbaDbMirrorMonitor.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ Describe "Add-DbaDbMirrorMonitor" {
$CommandUnderTest = Get-Command Add-DbaDbMirrorMonitor
}
It "Should have SqlInstance as a parameter" {
$CommandUnderTest | Should -HaveParameter SqlInstance -Type Dataplat.Dbatools.Parameter.DbaInstanceParameter[]
$CommandUnderTest | Should -HaveParameter SqlInstance
}
It "Should have SqlCredential as a parameter" {
$CommandUnderTest | Should -HaveParameter SqlCredential -Type System.Management.Automation.PSCredential
$CommandUnderTest | Should -HaveParameter SqlCredential
}
It "Should have EnableException as a parameter" {
$CommandUnderTest | Should -HaveParameter EnableException -Type System.Management.Automation.SwitchParameter
$CommandUnderTest | Should -HaveParameter EnableException
}
It "Should have WhatIf as a parameter" {
$CommandUnderTest | Should -HaveParameter WhatIf -Type System.Management.Automation.SwitchParameter
$CommandUnderTest | Should -HaveParameter WhatIf
}
It "Should have Confirm as a parameter" {
$CommandUnderTest | Should -HaveParameter Confirm -Type System.Management.Automation.SwitchParameter
$CommandUnderTest | Should -HaveParameter Confirm
}
}

Expand Down
14 changes: 7 additions & 7 deletions tests/Add-DbaDbRoleMember.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,25 @@ Describe "Add-DbaDbRoleMember" {

Context "Validate parameters" {
It "Should have SqlInstance as a parameter" {
$CommandUnderTest | Should -HaveParameter SqlInstance -Type Dataplat.Dbatools.Parameter.DbaInstanceParameter[]
$CommandUnderTest | Should -HaveParameter SqlInstance
}
It "Should have SqlCredential as a parameter" {
$CommandUnderTest | Should -HaveParameter SqlCredential -Type System.Management.Automation.PSCredential
$CommandUnderTest | Should -HaveParameter SqlCredential
}
It "Should have Database as a parameter" {
$CommandUnderTest | Should -HaveParameter Database -Type System.String[]
$CommandUnderTest | Should -HaveParameter Database
}
It "Should have Role as a parameter" {
$CommandUnderTest | Should -HaveParameter Role -Type System.String[]
$CommandUnderTest | Should -HaveParameter Role
}
It "Should have Member as a parameter" {
$CommandUnderTest | Should -HaveParameter Member -Type System.String[]
$CommandUnderTest | Should -HaveParameter Member
}
It "Should have InputObject as a parameter" {
$CommandUnderTest | Should -HaveParameter InputObject -Type System.Object[]
$CommandUnderTest | Should -HaveParameter InputObject
}
It "Should have EnableException as a parameter" {
$CommandUnderTest | Should -HaveParameter EnableException -Type System.Management.Automation.SwitchParameter
$CommandUnderTest | Should -HaveParameter EnableException
}
}

Expand Down
Loading

0 comments on commit adc6a8b

Please sign in to comment.