1- . " $PSScriptRoot /common/test-utils.ps1"
21
3- RunTest ' get-changelog with existing versions' {
4- $actual = & " $PSScriptRoot /../scripts/get-changelog.ps1" `
5- - RepoUrl ' https://github.com/getsentry/github-workflows' - OldTag ' 1.0.0' - NewTag ' 2.1.0'
6- $expected = @'
2+ Describe ' get-changelog' {
3+ It ' with existing versions' {
4+ $actual = & " $PSScriptRoot /../scripts/get-changelog.ps1" `
5+ - RepoUrl ' https://github.com/getsentry/github-workflows' - OldTag ' 1.0.0' - NewTag ' 2.1.0'
6+ $expected = @'
77## Changelog
88### 2.1.0
99
@@ -29,33 +29,33 @@ RunTest 'get-changelog with existing versions' {
2929- Changelog section parsing when an entry text contains the section name in the text ([#25](https://github-redirect.dependabot.com/getsentry/github-workflows/pull/25))
3030'@
3131
32- AssertEqual $expected $actual
33- }
32+ $actual | Should - Be $expected
33+ }
3434
35- RunTest ' get-changelog with missing versions' {
36- $actual = & " $PSScriptRoot /../scripts/get-changelog.ps1" `
37- - RepoUrl ' https://github.com/getsentry/sentry-javascript' - OldTag ' XXXXXXX' - NewTag ' YYYYYYYYY'
38- AssertEqual ' ' $actual
39- }
35+ It ' with missing versions' {
36+ $actual = & " $PSScriptRoot /../scripts/get-changelog.ps1" `
37+ - RepoUrl ' https://github.com/getsentry/sentry-javascript' - OldTag ' XXXXXXX' - NewTag ' YYYYYYYYY'
38+ $actual | Should - BeNullOrEmpty
39+ }
4040
41- RunTest ' get-changelog with missing repo' {
42- $actual = & " $PSScriptRoot /../scripts/get-changelog.ps1" `
43- - RepoUrl ' https://github.com/getsentry/foo-bar' - OldTag ' XXXXXXX' - NewTag ' YYYYYYYYY'
44- # May print a warning but still returns (an empty string)
45- AssertEqual ' ' $actual
46- }
41+ It ' with missing repo' {
42+ $actual = & " $PSScriptRoot /../scripts/get-changelog.ps1" `
43+ - RepoUrl ' https://github.com/getsentry/foo-bar' - OldTag ' XXXXXXX' - NewTag ' YYYYYYYYY'
44+ # May print a warning but still returns (an empty string)
45+ $actual | Should - BeNullOrEmpty
46+ }
4747
48- RunTest ' get-changelog with unsupported repo' {
49- $actual = & " $PSScriptRoot /../scripts/get-changelog.ps1" `
50- - RepoUrl ' https://dart.googlesource.com/args' - OldTag ' XXXXXXX' - NewTag ' YYYYYYYYY'
51- # May print a warning but still returns (an empty string)
52- AssertEqual ' ' $actual
53- }
48+ It ' with unsupported repo' {
49+ $actual = & " $PSScriptRoot /../scripts/get-changelog.ps1" `
50+ - RepoUrl ' https://dart.googlesource.com/args' - OldTag ' XXXXXXX' - NewTag ' YYYYYYYYY'
51+ # May print a warning but still returns (an empty string)
52+ $actual | Should - BeNullOrEmpty
53+ }
5454
55- RunTest ' get-changelog removes at-mentions' {
56- $actual = & " $PSScriptRoot /../scripts/get-changelog.ps1" `
57- - RepoUrl ' https://github.com/getsentry/sentry-cli' - OldTag ' 2.1.0' - NewTag ' 2.2.0'
58- $expected = @'
55+ It ' removes at-mentions' {
56+ $actual = & " $PSScriptRoot /../scripts/get-changelog.ps1" `
57+ - RepoUrl ' https://github.com/getsentry/sentry-cli' - OldTag ' 2.1.0' - NewTag ' 2.2.0'
58+ $expected = @'
5959## Changelog
6060### 2.2.0
6161
@@ -65,13 +65,13 @@ RunTest 'get-changelog removes at-mentions' {
6565- ref: Skip protected zip files when uploading debug files ([#1245](https://github-redirect.dependabot.com/getsentry/sentry-cli/issues/1245)) by kamilogorek
6666'@
6767
68- AssertEqual $expected $actual
69- }
68+ $actual | Should - Be $expected
69+ }
7070
71- RunTest " get-changelog removes doesn't duplicate PR links" {
72- $actual = & " $PSScriptRoot /../scripts/get-changelog.ps1" `
73- - RepoUrl ' https://github.com/getsentry/sentry-native' - OldTag ' 0.4.16' - NewTag ' 0.4.17'
74- $expected = @'
71+ It " get-changelog removes doesn't duplicate PR links" {
72+ $actual = & " $PSScriptRoot /../scripts/get-changelog.ps1" `
73+ - RepoUrl ' https://github.com/getsentry/sentry-native' - OldTag ' 0.4.16' - NewTag ' 0.4.17'
74+ $expected = @'
7575## Changelog
7676### 0.4.17
7777
@@ -86,20 +86,21 @@ Features, fixes and improvements in this release have been contributed by:
8686- [AenBleidd](https://github-redirect.dependabot.com/AenBleidd)
8787'@
8888
89- AssertEqual $expected $actual
90- }
91-
92- RunTest ' get-changelog truncates too long text' {
93- $actual = & " $PSScriptRoot /../scripts/get-changelog.ps1" `
94- - RepoUrl ' https://github.com/getsentry/sentry-cli' - OldTag ' 1.0.0' - NewTag ' 2.4.0'
95- if ($actual.Length -gt 61000 )
96- {
97- throw " Expected the content to be truncated to less-than 61k characters, but got: $ ( $actual.Length ) "
89+ $actual | Should - Be $expected
9890 }
99- $msg = " Changelog content truncated by [0-9]+ characters because it was over the limit \(60000\) and wouldn't fit into PR description."
100- if (" $actual " -notmatch $msg )
101- {
102- Write-Host $actual
103- throw " Expected changelog to contain message '$msg '"
91+
92+ It ' truncates too long text' {
93+ $actual = & " $PSScriptRoot /../scripts/get-changelog.ps1" `
94+ - RepoUrl ' https://github.com/getsentry/sentry-cli' - OldTag ' 1.0.0' - NewTag ' 2.4.0'
95+ if ($actual.Length -gt 61000 )
96+ {
97+ throw " Expected the content to be truncated to less-than 61k characters, but got: $ ( $actual.Length ) "
98+ }
99+ $msg = " Changelog content truncated by [0-9]+ characters because it was over the limit \(60000\) and wouldn't fit into PR description."
100+ if (" $actual " -notmatch $msg )
101+ {
102+ Write-Host $actual
103+ throw " Expected changelog to contain message '$msg '"
104+ }
104105 }
105106}
0 commit comments