File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments