Skip to content

Update references to New and Test PSScriptFile #34

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

Merged
merged 1 commit into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Test/NewPSScriptFile.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $modPath = "$psscriptroot/../PSGetTestUtils.psm1"
Import-Module $modPath -Force -Verbose
Write-Verbose -Verbose -Message "PowerShellGet version currently loaded: $($(Get-Module powershellget).Version)"

Describe "Test CompatPowerShellGet: New-PSScriptFile" -tags 'CI' {
Describe "Test CompatPowerShellGet: New-PSScriptFileInfo" -tags 'CI' {
BeforeAll {
$tmpDir1Path = Join-Path -Path $TestDrive -ChildPath "tmpDir1"
$tmpDirPaths = @($tmpDir1Path)
Expand All @@ -25,7 +25,7 @@ Describe "Test CompatPowerShellGet: New-PSScriptFile" -tags 'CI' {
It "Create .ps1 file with minimal required fields" {
$description = "Test description"
New-ScriptFileInfo -Path $script:testScriptFilePath -Description $description
Test-PSScriptFile -Path $script:testScriptFilePath | Should -BeTrue
Test-PSScriptFileInfo -Path $script:testScriptFilePath | Should -BeTrue
}

It "Create .ps1 file with relative path" {
Expand All @@ -35,7 +35,7 @@ Describe "Test CompatPowerShellGet: New-PSScriptFile" -tags 'CI' {
$description = "Test description"
New-ScriptFileInfo -Path $scriptFilePath -Description $description

Test-PSScriptFile -Path $scriptFilePath | Should -BeTrue
Test-PSScriptFileInfo -Path $scriptFilePath | Should -BeTrue
Remove-Item -Path $scriptFilePath
}

Expand Down
2 changes: 1 addition & 1 deletion Test/PublishPSResource.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ Describe "Test CompatPowerShellGet: Publish-PSResource" -tags 'CI' {
}

$scriptPath = (Join-Path -Path $script:tmpScriptsFolderPath -ChildPath "$scriptName.ps1")
New-PSScriptFile @params -Path $scriptPath
New-PSScriptFileInfo @params -Path $scriptPath

Publish-Script -Path $scriptPath

Expand Down
4 changes: 2 additions & 2 deletions Test/TestPSScriptFile.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Import-Module $modPath -Force -Verbose
Write-Verbose -Verbose -Message "PowerShellGet version currently loaded: $($(Get-Module powershellget).Version)"
$testDir = (get-item $psscriptroot).parent.FullName

Describe "Test CompatPowerShellGet: Test-PSScriptFile" -tags 'CI' {
Describe "Test CompatPowerShellGet: Test-PSScriptFileInfo" -tags 'CI' {
BeforeAll {
$tmpDir1Path = Join-Path -Path $TestDrive -ChildPath "tmpDir1"
$tmpDirPaths = @($tmpDir1Path)
Expand All @@ -25,7 +25,7 @@ Describe "Test CompatPowerShellGet: Test-PSScriptFile" -tags 'CI' {
$guid = [guid]::NewGuid()
$author = "Script Author"
$version = "1.0.0"
New-PSScriptFile -Path $scriptFilePath -Description $scriptDescription -Guid $guid -Author $author -Version $version
New-PSScriptFileInfo -Path $scriptFilePath -Description $scriptDescription -Guid $guid -Author $author -Version $version
Test-ScriptFileInfo $scriptFilePath | Should -Be $true
}

Expand Down
44 changes: 22 additions & 22 deletions Test/UpdatePSScriptFileInfo.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
$script:psScriptInfoName = "test_script"
$scriptDescription = "this is a test script"
$script:testScriptFilePath = Join-Path -Path $tmpDir1Path -ChildPath "$script:psScriptInfoName.ps1"
New-PSScriptFile -Path $script:testScriptFilePath -Description $scriptDescription
New-PSScriptFileInfo -Path $script:testScriptFilePath -Description $scriptDescription
}

AfterEach {
Expand All @@ -40,10 +40,10 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
$scriptFilePath = Join-Path -Path $relativeCurrentPath -ChildPath "$script:psScriptInfoName.ps1"
$oldDescription = "Old description for test script"
$newDescription = "New description for test script"
New-PSScriptFile -Path $scriptFilePath -Description $oldDescription
New-PSScriptFileInfo -Path $scriptFilePath -Description $oldDescription

Update-ScriptFileInfo -Path $scriptFilePath -Description $newDescription
Test-PSScriptFile -Path $scriptFilePath | Should -BeTrue
Test-PSScriptFileInfo -Path $scriptFilePath | Should -BeTrue

Test-Path -Path $scriptFilePath | Should -BeTrue
$results = Get-Content -Path $scriptFilePath -Raw
Expand All @@ -63,10 +63,10 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
$relativeCurrentPath = Get-Location
$scriptFilePath = Join-Path -Path $relativeCurrentPath -ChildPath "$script:psScriptInfoName.ps1"

New-PSScriptFile -Path $scriptFilePath -Description $description -Version $version -Author $author -ProjectUri $projectUri
New-PSScriptFileInfo -Path $scriptFilePath -Description $description -Version $version -Author $author -ProjectUri $projectUri
Update-ScriptFileInfo -Path $scriptFilePath -Author $newAuthor

Test-PSScriptFile -Path $scriptFilePath | Should -BeTrue
Test-PSScriptFileInfo -Path $scriptFilePath | Should -BeTrue
$results = Get-Content -Path $scriptFilePath -Raw
$results.Contains($newAuthor) | Should -BeTrue
$results.Contains(".AUTHOR $newAuthor") | Should -BeTrue
Expand All @@ -87,7 +87,7 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
It "update script file Author property" {
$author = "New Author"
Update-ScriptFileInfo -Path $script:testScriptFilePath -Author $author
Test-PSScriptFile $script:testScriptFilePath | Should -Be $true
Test-PSScriptFileInfo $script:testScriptFilePath | Should -Be $true

Test-Path -Path $script:testScriptFilePath | Should -BeTrue
$results = Get-Content -Path $script:testScriptFilePath -Raw
Expand All @@ -98,7 +98,7 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
It "update script file Version property" {
$version = "2.0.0.0"
Update-ScriptFileInfo -Path $script:testScriptFilePath -Version $version
Test-PSScriptFile $script:testScriptFilePath | Should -Be $true
Test-PSScriptFileInfo $script:testScriptFilePath | Should -Be $true

Test-Path -Path $script:testScriptFilePath | Should -BeTrue
$results = Get-Content -Path $script:testScriptFilePath -Raw
Expand All @@ -109,7 +109,7 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
It "update script file Version property with prerelease version" {
$version = "3.0.0-alpha"
Update-ScriptFileInfo -Path $script:testScriptFilePath -Version $version
Test-PSScriptFile $script:testScriptFilePath | Should -Be $true
Test-PSScriptFileInfo $script:testScriptFilePath | Should -Be $true

Test-Path -Path $script:testScriptFilePath | Should -BeTrue
$results = Get-Content -Path $script:testScriptFilePath -Raw
Expand All @@ -126,7 +126,7 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
It "update script file Description property" {
$description = "this is an updated test script"
Update-ScriptFileInfo -Path $script:testScriptFilePath -Description $description
Test-PSScriptFile $script:testScriptFilePath | Should -Be $true
Test-PSScriptFileInfo $script:testScriptFilePath | Should -Be $true

Test-Path -Path $script:testScriptFilePath | Should -BeTrue
$results = Get-Content -Path $script:testScriptFilePath -Raw
Expand All @@ -137,7 +137,7 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
It "update script file Guid property" {
$guid = [Guid]::NewGuid();
Update-ScriptFileInfo -Path $script:testScriptFilePath -Guid $guid
Test-PSScriptFile $script:testScriptFilePath | Should -Be $true
Test-PSScriptFileInfo $script:testScriptFilePath | Should -Be $true

Test-Path -Path $script:testScriptFilePath | Should -BeTrue
$results = Get-Content -Path $script:testScriptFilePath -Raw
Expand All @@ -148,7 +148,7 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
It "update script file CompanyName property" {
$companyName = "New Corporation"
Update-ScriptFileInfo -Path $script:testScriptFilePath -CompanyName $companyName
Test-PSScriptFile $script:testScriptFilePath | Should -Be $true
Test-PSScriptFileInfo $script:testScriptFilePath | Should -Be $true

Test-Path -Path $script:testScriptFilePath | Should -BeTrue
$results = Get-Content -Path $script:testScriptFilePath -Raw
Expand All @@ -159,7 +159,7 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
It "update script file Copyright property" {
$copyright = "(c) 2022 New Corporation. All rights reserved"
Update-ScriptFileInfo -Path $script:testScriptFilePath -Copyright $copyright
Test-PSScriptFile $script:testScriptFilePath | Should -Be $true
Test-PSScriptFileInfo $script:testScriptFilePath | Should -Be $true

Test-Path -Path $script:testScriptFilePath | Should -BeTrue
$results = Get-Content -Path $script:testScriptFilePath -Raw
Expand All @@ -171,7 +171,7 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
$externalModuleDep1 = "ExternalModuleDep1"
$externalModuleDep2 = "ExternalModuleDep2"
Update-ScriptFileInfo -Path $script:testScriptFilePath -ExternalModuleDependencies $externalModuleDep1,$externalModuleDep2
Test-PSScriptFile $script:testScriptFilePath | Should -Be $true
Test-PSScriptFileInfo $script:testScriptFilePath | Should -Be $true

Test-Path -Path $script:testScriptFilePath | Should -BeTrue
$results = Get-Content -Path $script:testScriptFilePath -Raw
Expand All @@ -184,7 +184,7 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
$externalScriptDep1 = "ExternalScriptDep1"
$externalScriptDep2 = "ExternalScriptDep2"
Update-ScriptFileInfo -Path $script:testScriptFilePath -ExternalScriptDependencies $externalScriptDep1,$externalScriptDep2
Test-PSScriptFile $script:testScriptFilePath | Should -Be $true
Test-PSScriptFileInfo $script:testScriptFilePath | Should -Be $true

Test-Path -Path $script:testScriptFilePath | Should -BeTrue
$results = Get-Content -Path $script:testScriptFilePath -Raw
Expand All @@ -196,7 +196,7 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
It "update script file IconUri property" {
$iconUri = "https://testscript.com/icon"
Update-ScriptFileInfo -Path $script:testScriptFilePath -IconUri $iconUri
Test-PSScriptFile $script:testScriptFilePath | Should -Be $true
Test-PSScriptFileInfo $script:testScriptFilePath | Should -Be $true

Test-Path -Path $script:testScriptFilePath | Should -BeTrue
$results = Get-Content -Path $script:testScriptFilePath -Raw
Expand All @@ -207,7 +207,7 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
It "update script file LicenseUri property" {
$licenseUri = "https://testscript.com/license"
Update-ScriptFileInfo -Path $script:testScriptFilePath -LicenseUri $licenseUri
Test-PSScriptFile $script:testScriptFilePath | Should -Be $true
Test-PSScriptFileInfo $script:testScriptFilePath | Should -Be $true

Test-Path -Path $script:testScriptFilePath | Should -BeTrue
$results = Get-Content -Path $script:testScriptFilePath -Raw
Expand All @@ -218,7 +218,7 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
It "update script file ProjectUri property" {
$projectUri = "https://testscript.com/"
Update-ScriptFileInfo -Path $script:testScriptFilePath -ProjectUri $projectUri
Test-PSScriptFile $script:testScriptFilePath | Should -Be $true
Test-PSScriptFileInfo $script:testScriptFilePath | Should -Be $true

Test-Path -Path $script:testScriptFilePath | Should -BeTrue
$results = Get-Content -Path $script:testScriptFilePath -Raw
Expand All @@ -229,7 +229,7 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
It "update script file PrivateData property" {
$privateData = "this is some private data"
Update-ScriptFileInfo -Path $script:testScriptFilePath -PrivateData $privateData
Test-PSScriptFile $script:testScriptFilePath | Should -Be $true
Test-PSScriptFileInfo $script:testScriptFilePath | Should -Be $true

Test-Path -Path $script:testScriptFilePath | Should -BeTrue
$results = Get-Content -Path $script:testScriptFilePath -Raw
Expand All @@ -240,7 +240,7 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
It "update script file ReleaseNotes property" {
$releaseNotes = "Release notes for script."
Update-ScriptFileInfo -Path $script:testScriptFilePath -ReleaseNotes $releaseNotes
Test-PSScriptFile $script:testScriptFilePath | Should -Be $true
Test-PSScriptFileInfo $script:testScriptFilePath | Should -Be $true

Test-Path -Path $script:testScriptFilePath | Should -BeTrue
$results = Get-Content -Path $script:testScriptFilePath -Raw
Expand All @@ -256,7 +256,7 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
$requiredModules = @($hashtable1, $hashtable2, $hashtable3, $hashtable4)

Update-ScriptFileInfo -Path $script:testScriptFilePath -RequiredModules $requiredModules
Test-PSScriptFile $script:testScriptFilePath | Should -Be $true
Test-PSScriptFileInfo $script:testScriptFilePath | Should -Be $true

Test-Path -Path $script:testScriptFilePath | Should -BeTrue
$results = Get-Content -Path $script:testScriptFilePath -Raw
Expand All @@ -269,7 +269,7 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
$requiredScript1 = "RequiredScript1"
$requiredScript2 = "RequiredScript2"
Update-ScriptFileInfo -Path $script:testScriptFilePath -RequiredScripts $requiredScript1, $requiredScript2
Test-PSScriptFile $script:testScriptFilePath | Should -Be $true
Test-PSScriptFileInfo $script:testScriptFilePath | Should -Be $true

Test-Path -Path $script:testScriptFilePath | Should -BeTrue
$results = Get-Content -Path $script:testScriptFilePath -Raw
Expand All @@ -282,7 +282,7 @@ Describe "Test CompatPowerShellGet: Update-PSScriptFileInfo" -tags 'CI' {
$tag1 = "tag1"
$tag2 = "tag2"
Update-ScriptFileInfo -Path $script:testScriptFilePath -Tags $tag1, $tag2
Test-PSScriptFile $script:testScriptFilePath | Should -Be $true
Test-PSScriptFileInfo $script:testScriptFilePath | Should -Be $true

Test-Path -Path $script:testScriptFilePath | Should -BeTrue
$results = Get-Content -Path $script:testScriptFilePath -Raw
Expand Down
4 changes: 2 additions & 2 deletions src/CompatPowerShellGet.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,7 @@ param(
if ( $PSBoundParameters['PassThru'] ) { $null = $PSBoundParameters.Remove('PassThru') }
# END PARAMETER MAP

$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('New-PSScriptFile', [System.Management.Automation.CommandTypes]::Cmdlet)
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('New-PSScriptFileInfo', [System.Management.Automation.CommandTypes]::Cmdlet)
$scriptCmd = {& $wrappedCmd @PSBoundParameters }

$steppablePipeline = $scriptCmd.GetSteppablePipeline()
Expand Down Expand Up @@ -2062,7 +2062,7 @@ param(
if ( $PSBoundParameters['LiteralPath'] ) { $null = $PSBoundParameters.Remove('LiteralPath'); $PSBoundParameters['Path'] = $LiteralPath }
# END PARAMETER MAP

$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Test-PSScriptFile', [System.Management.Automation.CommandTypes]::Cmdlet)
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Test-PSScriptFileInfo', [System.Management.Automation.CommandTypes]::Cmdlet)
$scriptCmd = {& $wrappedCmd @PSBoundParameters }

$steppablePipeline = $scriptCmd.GetSteppablePipeline()
Expand Down