File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -275,6 +275,39 @@ Describe 'Update notification behavior' {
275275 }
276276 }
277277
278+ It ' Get-NovaModuleSelfUpdatePlanContext returns empty lookup fields when no lookup result is available' {
279+ InModuleScope $script :moduleName {
280+ $result = Get-NovaModuleSelfUpdatePlanContext - LookupResult $null - PrereleaseNotificationsEnabled:$true
281+
282+ $result.LookupCandidateVersion | Should - BeNullOrEmpty
283+ $result.LookupCandidateChannel | Should - BeNullOrEmpty
284+ $result.LookupRepository | Should - BeNullOrEmpty
285+ $result.PrereleaseNotificationsEnabled | Should - BeTrue
286+ }
287+ }
288+
289+ It ' Get-NovaModuleSelfUpdatePlanContext falls back to SourceRepository when the selected lookup candidate omits Repository' {
290+ InModuleScope $script :moduleName {
291+ $lookupResult = [pscustomobject ]@ {
292+ SourceRepository = ' PSGallery'
293+ Stable = [pscustomobject ]@ {
294+ Version = ' 1.9.1'
295+ Channel = ' Stable'
296+ }
297+ Prerelease = [pscustomobject ]@ {
298+ Version = ' 2.0.0-beta'
299+ Channel = ' Prerelease'
300+ }
301+ }
302+
303+ $result = Get-NovaModuleSelfUpdatePlanContext - LookupResult $lookupResult - PrereleaseNotificationsEnabled:$true
304+
305+ $result.LookupCandidateVersion | Should - Be ' 2.0.0-beta'
306+ $result.LookupCandidateChannel | Should - Be ' Prerelease'
307+ $result.LookupRepository | Should - Be ' PSGallery'
308+ }
309+ }
310+
278311 It ' Get-NovaModuleSelfUpdateWorkflowContext throws when update lookup cannot resolve a candidate' {
279312 InModuleScope $script :moduleName {
280313 Mock Read-NovaUpdateNotificationPreference {[pscustomobject ]@ {PrereleaseNotificationsEnabled = $true }}
You can’t perform that action at this time.
0 commit comments