Skip to content

Commit ec8d96e

Browse files
Merge branch 'main' into feat/1243
2 parents 386bcd0 + dd2ae45 commit ec8d96e

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

scripts/linting/Invoke-LinkLanguageCheck.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function Invoke-LinkLanguageCheckCore {
7070
}
7171

7272
$outputData = @{
73-
timestamp = (Get-Date).ToUniversalTime().ToString("o")
73+
timestamp = Get-StandardTimestamp
7474
script = "link-lang-check"
7575
summary = @{
7676
total_issues = $results.Count
@@ -116,7 +116,7 @@ $(($uniqueFiles | ForEach-Object {
116116
Write-Host "✅ No URLs with language paths found" -ForegroundColor Green
117117

118118
$emptyResults = @{
119-
timestamp = (Get-Date).ToUniversalTime().ToString("o")
119+
timestamp = Get-StandardTimestamp
120120
script = "link-lang-check"
121121
summary = @{
122122
total_issues = 0

scripts/tests/linting/Invoke-LinkLanguageCheck.Tests.ps1

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,18 @@ Write-Output $json
120120
$script:WriteHostMessages | Should -Contain '📄 docs/a.md'
121121
$script:WriteHostMessages | Should -Contain '📄 docs/b.md'
122122
}
123+
124+
It 'Calls Get-StandardTimestamp for result JSON timestamp' {
125+
Mock Get-StandardTimestamp { return 'MOCK-TIMESTAMP' }
126+
127+
Invoke-LinkLanguageCheckCore -ExcludePaths @('scripts/tests/**') | Out-Null
128+
129+
Should -Invoke Get-StandardTimestamp -Times 1
130+
131+
$resultFile = Join-Path $script:RepoRoot 'logs/link-lang-check-results.json'
132+
$json = Get-Content $resultFile -Raw | ConvertFrom-Json
133+
$json.timestamp | Should -Be 'MOCK-TIMESTAMP'
134+
}
123135
}
124136

125137
Context 'No issues found' {
@@ -162,6 +174,18 @@ Write-Output $json
162174
Should -Invoke Write-Host -Times 0 -ParameterFilter { $Object -like '*📄*' }
163175
Should -Invoke Write-Host -Times 0 -ParameterFilter { $Object -like '*⚠️*' }
164176
}
177+
178+
It 'Calls Get-StandardTimestamp for empty result JSON timestamp' {
179+
Mock Get-StandardTimestamp { return 'MOCK-TIMESTAMP' }
180+
181+
Invoke-LinkLanguageCheckCore -ExcludePaths @() | Out-Null
182+
183+
Should -Invoke Get-StandardTimestamp -Times 1
184+
185+
$resultFile = Join-Path $script:RepoRoot 'logs/link-lang-check-results.json'
186+
$json = Get-Content $resultFile -Raw | ConvertFrom-Json
187+
$json.timestamp | Should -Be 'MOCK-TIMESTAMP'
188+
}
165189
}
166190
}
167191

0 commit comments

Comments
 (0)