Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit 357b9fa

Browse files
committed
Carry over change from PR #25
1 parent babc343 commit 357b9fa

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

OperationValidation/Diagnostics/Comprehensive/PSGallery.Comprehensive.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Describe "E2E validation of PSGallery" {
1+
Describe "E2E validation of PSGallery" -Fixture {
22
BeforeAll {
33
$Repository = "InternalPSGallery"
44
$ModuleName = "FormatTools"
@@ -8,7 +8,7 @@ Describe "E2E validation of PSGallery" {
88
{
99
# the module is already installed
1010
$PSDefaultParameterValues["It:skip"] = $true
11-
}
11+
}
1212
}
1313

1414
It "should return the same number of modules via cmdlets and website" {

OperationValidation/Diagnostics/Simple/PSGallery.Simple.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Describe "Simple Validation of PSGallery" {
1+
Describe -Name "Simple Validation of PSGallery" {
22
It "The PowerShell Gallery should be responsive" {
33
$request = [System.Net.WebRequest]::Create("http://psget/psgallery")
44
$response = $Request.GetResponse()

OperationValidation/Private/Get-TestFromScript.ps1

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,19 @@ function Get-TestFromScript
1717
}, $true) |
1818
ForEach-Object {
1919
# This is the name of the 'describe' block
20-
$describeName = ($_.CommandElements | Where-Object { $_.StaticType.name -eq 'string' })[1].SafeGetValue()
21-
20+
for ($x = 0; $x -lt $_.CommandElements.Count; $x++)
21+
{
22+
# Name parameter is named
23+
if ($_.CommandElements[$x] -is [System.Management.Automation.Language.CommandParameterAst] -and $_.CommandElements[$x].ParameterName -eq 'Name')
24+
{
25+
$describeName = $_.CommandElements[$x + 1].value
26+
}
27+
# if we have a string without a parameter name, return first hit. Name parameter is at position 0.
28+
ElseIf (($_.CommandElements[$x] -is [System.Management.Automation.Language.StringConstantExpressionAst]) -and ($_.CommandElements[$x - 1] -is [System.Management.Automation.Language.StringConstantExpressionAst]))
29+
{
30+
$describeName = $_.CommandElements[$x].value
31+
}
32+
}
2233
$item = [PSCustomObject][ordered]@{
2334
Name = $describeName
2435
Tags = @()

0 commit comments

Comments
 (0)