1- $here = Split-Path - Parent $MyInvocation.MyCommand.Path
2- . (Join-Path (Join-Path (Join-Path $here " .." ) " scripts" ) " common.ps1" )
1+ BeforeAll {
2+ . (Join-Path $PSScriptRoot " .." " scripts" " common.ps1" )
3+ }
34
45Describe " New-GitHubHeaders" {
56
67 It " returns User-Agent header without token" {
78 $env: GITHUB_TOKEN = " "
89 $h = New-GitHubHeaders
9- $h [" User-Agent" ] | Should Be " dusan-maintains-oss-log"
10- $h.ContainsKey (" Authorization" ) | Should Be $false
10+ $h [" User-Agent" ] | Should - Be " dusan-maintains-oss-log"
11+ $h.ContainsKey (" Authorization" ) | Should - Be $false
1112 }
1213
1314 It " includes Authorization when GITHUB_TOKEN is set" {
1415 $env: GITHUB_TOKEN = " test-token-123"
1516 try {
1617 $h = New-GitHubHeaders
17- $h [" Authorization" ] | Should Be " Bearer test-token-123"
18- $h [" X-GitHub-Api-Version" ] | Should Be " 2022-11-28"
18+ $h [" Authorization" ] | Should - Be " Bearer test-token-123"
19+ $h [" X-GitHub-Api-Version" ] | Should - Be " 2022-11-28"
1920 } finally {
2021 $env: GITHUB_TOKEN = " "
2122 }
@@ -26,21 +27,25 @@ Describe "Get-RepoRoot" {
2627
2728 It " returns the parent of scripts directory" {
2829 $root = Get-RepoRoot
29- $root | Should Not BeNullOrEmpty
30- (Test-Path (Join-Path $root " scripts" )) | Should Be $true
30+ $root | Should - Not - BeNullOrEmpty
31+ (Test-Path (Join-Path $root " scripts" )) | Should - Be $true
3132 }
3233}
3334
3435Describe " Resolve-RepoPath" {
3536
3637 It " resolves a relative path to repo root" {
3738 $resolved = Resolve-RepoPath - Path " config/tracked-repositories.json"
38- $resolved | Should Match " tracked-repositories\.json$"
39+ $resolved | Should - Match " tracked-repositories\.json$"
3940 }
4041
4142 It " returns absolute paths unchanged" {
42- $abs = " C:\absolute\path.json"
43- (Resolve-RepoPath - Path $abs ) | Should Be $abs
43+ if ($IsWindows -or $env: OS -match " Windows" ) {
44+ $abs = " C:\absolute\path.json"
45+ } else {
46+ $abs = " /absolute/path.json"
47+ }
48+ (Resolve-RepoPath - Path $abs ) | Should - Be $abs
4449 }
4550}
4651
@@ -49,9 +54,9 @@ Describe "Ensure-Directory" {
4954 It " creates a directory if it does not exist" {
5055 $testDir = Join-Path ([System.IO.Path ]::GetTempPath()) " oss-test-$ ( Get-Random ) "
5156 try {
52- (Test-Path $testDir ) | Should Be $false
57+ (Test-Path $testDir ) | Should - Be $false
5358 Ensure- Directory - Path $testDir
54- (Test-Path $testDir ) | Should Be $true
59+ (Test-Path $testDir ) | Should - Be $true
5560 } finally {
5661 if (Test-Path $testDir ) { Remove-Item $testDir - Recurse - Force }
5762 }
@@ -61,7 +66,7 @@ Describe "Ensure-Directory" {
6166 $testDir = Join-Path ([System.IO.Path ]::GetTempPath()) " oss-test-$ ( Get-Random ) "
6267 New-Item - ItemType Directory - Path $testDir | Out-Null
6368 try {
64- { Ensure- Directory - Path $testDir } | Should Not Throw
69+ { Ensure- Directory - Path $testDir } | Should - Not - Throw
6570 } finally {
6671 Remove-Item $testDir - Recurse - Force
6772 }
@@ -72,18 +77,18 @@ Describe "Get-TrackedConfig" {
7277
7378 It " parses the default config file" {
7479 $cfg = Get-TrackedConfig
75- $cfg.version | Should Be 1
76- $cfg.contributor | Should Be " dusan-maintains"
77- $cfg.repositories.Count | Should BeGreaterThan 4
80+ $cfg.version | Should - Be 1
81+ $cfg.contributor | Should - Be " dusan-maintains"
82+ $cfg.repositories.Count | Should - BeGreaterThan 4
7883 }
7984
8085 It " each repository has required fields" {
8186 $cfg = Get-TrackedConfig
8287 foreach ($repo in $cfg.repositories ) {
83- $repo.owner | Should Not BeNullOrEmpty
84- $repo.repo | Should Not BeNullOrEmpty
85- $repo.tracked_pr_numbers | Should Not BeNullOrEmpty
86- $repo.review_sla_base_name | Should Not BeNullOrEmpty
88+ $repo.owner | Should - Not - BeNullOrEmpty
89+ $repo.repo | Should - Not - BeNullOrEmpty
90+ $repo.tracked_pr_numbers | Should - Not - BeNullOrEmpty
91+ $repo.review_sla_base_name | Should - Not - BeNullOrEmpty
8792 }
8893 }
8994}
@@ -92,14 +97,14 @@ Describe "Convert-StringToUtcDateTime" {
9297
9398 It " parses ISO 8601 strings" {
9499 $dt = Convert-StringToUtcDateTime - Value " 2026-03-15T12:30:00Z"
95- $dt.Year | Should Be 2026
96- $dt.Month | Should Be 3
97- $dt.Day | Should Be 15
98- $dt.Hour | Should Be 12
99- $dt.Minute | Should Be 30
100+ $dt.Year | Should - Be 2026
101+ $dt.Month | Should - Be 3
102+ $dt.Day | Should - Be 15
103+ $dt.Hour | Should - Be 12
104+ $dt.Minute | Should - Be 30
100105 }
101106
102107 It " throws on invalid input" {
103- { Convert-StringToUtcDateTime - Value " not-a-date" } | Should Throw
108+ { Convert-StringToUtcDateTime - Value " not-a-date" } | Should - Throw
104109 }
105110}
0 commit comments