Skip to content

Commit 139d57a

Browse files
vaindclaude
andcommitted
test: add deterministic test case for specific version matching
- Add test that matches exact release version (2.11.1) by title pattern - This provides a deterministic test case that verifies exact behavior - Fix error handling to ensure proper error message when no releases match - All 4 gh-title-pattern tests now pass 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 4d09c54 commit 139d57a

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

updater/scripts/update-dependency.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ if ("$Tag" -eq '') {
185185
$originalTagCount = $tags.Length
186186
$tags = @($tags | Where-Object { $validTags.ContainsKey($_) })
187187
Write-Host "GitHub release title filtering: $originalTagCount -> $($tags.Count) tags"
188+
189+
if ($tags.Count -eq 0) {
190+
throw "Found no tags with GitHub releases matching title pattern '$GhTitlePattern'"
191+
}
188192
}
189193

190194
if ("$Pattern" -eq '') {

updater/tests/update-dependency.Tests.ps1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,21 @@ FetchContent_Declare(
458458
{ UpdateDependency $testFile '' 'NonExistentPattern' } | Should -Throw '*Found no tags with GitHub releases matching title pattern*'
459459
}
460460

461+
It 'matches specific release version by exact title pattern' {
462+
$testFile = "$testDir/test.properties"
463+
$repo = 'https://github.com/getsentry/github-workflows'
464+
@("repo=$repo", 'version=0') | Out-File $testFile
465+
466+
# Target a specific known release by exact title match
467+
UpdateDependency $testFile '' '^2\.11\.1$'
468+
469+
$content = Get-Content $testFile
470+
$version = ($content | Where-Object { $_ -match '^version\s*=\s*(.+)$' }) -replace '^version\s*=\s*', ''
471+
472+
# Should get exactly version 2.11.1 (with or without 'v' prefix)
473+
$version | Should -Match '^v?2\.11\.1$'
474+
}
475+
461476
It 'works without title pattern (backward compatibility)' {
462477
$testFile = "$testDir/test.properties"
463478
$repo = 'https://github.com/getsentry/sentry-cocoa'

0 commit comments

Comments
 (0)