mirror of
https://github.com/PowerShell/PowerShell.git
synced 2024-11-23 17:53:58 +08:00
b409e5613a
Co-authored-by: Dongbo Wang <dongbow@microsoft.com> --------- Co-authored-by: Dongbo Wang <dongbow@microsoft.com>
79 lines
2.5 KiB
PowerShell
79 lines
2.5 KiB
PowerShell
# Copyright (c) Microsoft Corporation.
|
|
# Licensed under the MIT License.
|
|
|
|
BeforeDiscovery {
|
|
|
|
$testCases = @(
|
|
@{
|
|
remoteInfo = 'upstream git@ssh.dev.azure.com:v3/azDoOrg/PowerShellCore/PowerShell (fetch)'
|
|
upstreamRemote = 'upstream'
|
|
org = 'azDoOrg'
|
|
project = 'PowerShellCore'
|
|
UpstreamHost = 'git@ssh.dev.azure.com'
|
|
RemoteType = 'AzureRepo'
|
|
}
|
|
@{
|
|
remoteInfo = 'upstream https://azDoOrg.visualstudio.com/PowerShell/_git/PowerShell (fetch)'
|
|
upstreamRemote = 'upstream'
|
|
org = 'azDoOrg'
|
|
project = 'PowerShell'
|
|
UpstreamHost = 'azDoOrg.visualstudio.com'
|
|
RemoteType = 'AzureRepo'
|
|
}
|
|
@{
|
|
remoteInfo = 'upstream https://github.com/PowerShell/PowerShell.git (fetch)'
|
|
upstreamRemote = 'upstream'
|
|
org = 'PowerShell'
|
|
project = 'github.com'
|
|
UpstreamHost = 'github.com'
|
|
RemoteType = 'GitHub'
|
|
}
|
|
@{
|
|
remoteInfo = 'github https://github.com/PowerShell/PowerShell.git (fetch)'
|
|
upstreamRemote = 'github'
|
|
org = 'PowerShell'
|
|
project = 'github.com'
|
|
UpstreamHost = 'github.com'
|
|
RemoteType = 'GitHub'
|
|
}
|
|
@{
|
|
remoteInfo = 'asonetuhasoeu git@github.com:PowerShell/PowerShell.git (fetch)'
|
|
upstreamRemote = 'asonetuhasoeu'
|
|
org = 'PowerShell'
|
|
project = 'github.com'
|
|
UpstreamHost = 'github.com'
|
|
RemoteType = 'GitHub'
|
|
}
|
|
|
|
)
|
|
}
|
|
Describe "Get-UpstreamInfo" {
|
|
BeforeAll {
|
|
Import-Module $PSScriptRoot/../../tools/releaseTools.psm1 -force -Verbose
|
|
}
|
|
It "parses remote Info correctly: <RemoteInfo>" -TestCases $testCases -Test {
|
|
param(
|
|
[string]
|
|
$RemoteInfo,
|
|
[string]
|
|
$UpstreamRemote,
|
|
[string]
|
|
$org,
|
|
[string]
|
|
$Project,
|
|
[string]
|
|
$UpstreamHost,
|
|
[string]
|
|
$remoteType
|
|
)
|
|
|
|
$upstreamInfo = Get-UpstreamInfo -Upstream $RemoteInfo -UpstreamRemote $UpstreamRemote
|
|
$upstreamInfo | Should -Not -BeNullOrEmpty
|
|
$upstreamInfo.org | Should -Be $org
|
|
$upstreamInfo.project | Should -Be $Project
|
|
$upstreamInfo.repo | Should -Be 'PowerShell'
|
|
$upstreamInfo.host | Should -Be $UpstreamHost
|
|
$upstreamInfo.remoteType | Should -Be $remoteType
|
|
}
|
|
}
|