mirror of
https://github.com/actions/runner-images.git
synced 2025-12-20 06:35:47 +00:00
Implement tests for software-report-module (#6815)
* Minor improvements * fix typos * fix brew rendering * add temp test * Implement tests * Add arguments validation * ToMarkdown() * Use before-All and helpers * Get rid of arrays * Add validation, no new nodes after header * Fix naming * add workflow * Revisit comments + tiny improvements * Fix tables * Fix html table indent * remove comment * attemp to break test - testing CI * revert breaking test * fix nitpicks
This commit is contained in:
@@ -2,6 +2,7 @@ using module ./SoftwareReport.BaseNodes.psm1
|
||||
using module ./SoftwareReport.Nodes.psm1
|
||||
|
||||
class SoftwareReport {
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[HeaderNode] $Root
|
||||
|
||||
SoftwareReport([String] $Title) {
|
||||
@@ -16,13 +17,18 @@ class SoftwareReport {
|
||||
return $this.Root.ToJsonObject() | ConvertTo-Json -Depth 10
|
||||
}
|
||||
|
||||
static [SoftwareReport] FromJson($jsonString) {
|
||||
$jsonObj = $jsonString | ConvertFrom-Json
|
||||
static [SoftwareReport] FromJson([String] $JsonString) {
|
||||
$jsonObj = $JsonString | ConvertFrom-Json
|
||||
$rootNode = [NodesFactory]::ParseNodeFromObject($jsonObj)
|
||||
return [SoftwareReport]::new($rootNode)
|
||||
}
|
||||
|
||||
[String] ToMarkdown() {
|
||||
return $this.Root.ToMarkdown(1).Trim()
|
||||
return $this.Root.ToMarkdown().Trim()
|
||||
}
|
||||
|
||||
[String] GetImageVersion() {
|
||||
$imageVersionNode = $this.Root.Children ?? @() | Where-Object { ($_ -is [ToolVersionNode]) -and ($_.ToolName -eq "Image Version:") } | Select-Object -First 1
|
||||
return $imageVersionNode.Version ?? "Unknown version"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user