2021-10-21 08:38:16 +03:00
|
|
|
|
Get-Module TestActionsHelper | Remove-Module -Force
|
|
|
|
|
Import-Module (Join-Path $PSScriptRoot 'TestActionsHelper.psm1')
|
2024-05-14 10:27:47 +03:00
|
|
|
|
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
|
2021-10-21 08:38:16 +03:00
|
|
|
|
|
2021-10-21 09:10:07 +03:00
|
|
|
|
Describe "CreateApp Action Tests" {
|
2021-10-22 00:31:19 +03:00
|
|
|
|
BeforeAll {
|
|
|
|
|
$actionName = "CreateApp"
|
|
|
|
|
$scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve
|
2021-11-01 12:18:28 +03:00
|
|
|
|
$scriptName = "$actionName.ps1"
|
2023-09-05 11:40:42 +03:00
|
|
|
|
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'scriptPath', Justification = 'False positive.')]
|
2021-11-01 12:18:28 +03:00
|
|
|
|
$scriptPath = Join-Path $scriptRoot $scriptName
|
2023-09-05 11:40:42 +03:00
|
|
|
|
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')]
|
2021-11-01 12:18:28 +03:00
|
|
|
|
$actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName
|
2021-10-22 00:31:19 +03:00
|
|
|
|
}
|
|
|
|
|
|
2021-10-21 08:38:16 +03:00
|
|
|
|
It 'Compile Action' {
|
2021-10-21 09:03:36 +03:00
|
|
|
|
Invoke-Expression $actionScript
|
2021-10-21 08:38:16 +03:00
|
|
|
|
}
|
2021-10-20 22:57:40 +03:00
|
|
|
|
|
|
|
|
|
It 'Test action.yaml matches script' {
|
|
|
|
|
$permissions = [ordered]@{
|
|
|
|
|
"contents" = "write"
|
|
|
|
|
"pull-requests" = "write"
|
|
|
|
|
}
|
2021-10-21 08:53:21 +03:00
|
|
|
|
$outputs = [ordered]@{
|
2021-10-21 08:38:16 +03:00
|
|
|
|
}
|
2021-10-21 09:03:36 +03:00
|
|
|
|
YamlTest -scriptRoot $scriptRoot -actionName $actionName -actionScript $actionScript -permissions $permissions -outputs $outputs
|
2021-10-20 22:57:40 +03:00
|
|
|
|
}
|
|
|
|
|
|
2021-10-21 08:38:16 +03:00
|
|
|
|
# Call action
|
|
|
|
|
|
2021-10-20 22:57:40 +03:00
|
|
|
|
}
|