maksit-webui/utils/modules/Engine/TestSupport.psm1
Maksym Sadovnychyy 6474f1f7c4
Some checks failed
Storybook tests / storybook-tests (push) Has been cancelled
(feature): add FileBrowser/Modal/Loader/Masonry/LightBox/CookieConsent/Ratings/social buttons and core hooks
2026-07-24 15:55:49 +02:00

49 lines
1.4 KiB
PowerShell

#requires -Version 7.0
#requires -PSEdition Core
$modulesDir = Split-Path $PSScriptRoot -Parent
if (-not (Get-Command Write-Log -ErrorAction SilentlyContinue)) {
$loggingModulePath = Join-Path $modulesDir "Logging.psm1"
if (Test-Path $loggingModulePath -PathType Leaf) {
Import-Module $loggingModulePath -Force
}
}
function New-EngineContext {
param(
[Parameter(Mandatory = $true)]
[string]$ScriptDir,
[Parameter(Mandatory = $true)]
[string]$SrcDir,
[Parameter(Mandatory = $false)]
[psobject]$Settings,
[ValidateSet('single', 'ha')]
[string]$DeployMode = 'ha'
)
$badgesDir = $null
if ($Settings -and $Settings.PSObject.Properties['paths'] -and $Settings.paths.badgesDir) {
$badgesDir = [System.IO.Path]::GetFullPath((Join-Path $ScriptDir ([string]$Settings.paths.badgesDir)))
}
$readmePath = $null
if ($Settings -and $Settings.PSObject.Properties['paths'] -and $Settings.paths.readmePath) {
$readmePath = [System.IO.Path]::GetFullPath((Join-Path $ScriptDir ([string]$Settings.paths.readmePath)))
}
return [pscustomobject]@{
scriptDir = $ScriptDir
srcDir = $SrcDir
utilsDir = $SrcDir
badgesDir = $badgesDir
readmePath = $readmePath
deployMode = $DeployMode
}
}
Export-ModuleMember -Function New-EngineContext