You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: git-tool-audit-prune.tests.ps1
+80-65Lines changed: 80 additions & 65 deletions
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@ Describe 'Invoke-PruneAudit' {
4
4
Import-Module-Scope Local "$PSScriptRoot/utils/framework.mocks.psm1"
5
5
Import-Module-Scope Local "$PSScriptRoot/utils/input.mocks.psm1"
6
6
Import-Module-Scope Local "$PSScriptRoot/utils/query-state.mocks.psm1"
7
+
Import-Module-Scope Local "$PSScriptRoot/utils/actions.mocks.psm1"
7
8
8
9
functionInitialize-ValidDownstreamBranchNames {
9
10
$upstreams=Select-AllUpstreamBranches
@@ -22,16 +23,6 @@ Describe 'Invoke-PruneAudit' {
22
23
BeforeEach {
23
24
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUserDeclaredVarsMoreThanAssignments','', Justification='This is put in scope and used in the tests below')]
24
25
$fw=Register-Framework
25
-
26
-
27
-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUserDeclaredVarsMoreThanAssignments','', Justification='This is put in scope and used in the tests below')]
'feature/XYZ-1-services'=@('infra/shared') # intentionally have an extra configured branch here for removal
108
+
}
109
+
Initialize-ValidDownstreamBranchNames
110
+
111
+
$mock=@(
112
+
Initialize-LocalActionSetUpstream@{
113
+
'feature/XYZ-1-services'=$null
114
+
'rc/2022-07-14'=@("feature/FOO-123")
115
+
} "Applied changes from 'prune' audit"'new-commit'
116
+
Initialize-FinalizeActionSetBranches@{
117
+
'_upstream'='new-commit'
118
+
}
119
+
)
96
120
97
-
&$PSScriptRoot/git-tool-audit-prune.ps1
98
-
$fw.assertDiagnosticOutput| Should -BeNullOrEmpty
121
+
&$PSScriptRoot/git-tool-audit-prune.ps1
122
+
$fw.assertDiagnosticOutput.Count| Should -Be 1
123
+
$fw.assertDiagnosticOutput| Should -Contain "WARN: Removing 'infra/shared' from upstream branches of 'rc/2022-07-14'; it is redundant via the following: feature/FOO-123"
0 commit comments