Skip to content

Commit

Permalink
Add missing package readme back in index table readme (Azure#32612)
Browse files Browse the repository at this point in the history
  • Loading branch information
sima-zhu authored Nov 22, 2022
1 parent ec2fbef commit 7adc746
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 1 deletion.
4 changes: 4 additions & 0 deletions eng/scripts/docs/Docs-ToC.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,7 @@ function Get-Toc-Children($package, $version, $docRepoLocation, $folderName) {
Set-Content $packageJsonPath -Value ($packageJson | ConvertTo-Json)
return $namespaces
}

function Get-dotnet-PackageLevelReadme ($packageMetadata) {
return GetPackageReadmeName -packageMetadata $packageMetadata
}
19 changes: 18 additions & 1 deletion eng/scripts/docs/tests/Service-Readme-Generation-Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
```
Invoke-Pester -Output Detailed $PSScriptRoot/Service-Readme-Generation-Tests.ps1
We are testing the Get-dotnet-OnboardedDocsMsPackagesForMoniker function in Docs-ToC.sp1
We are testing:
1. Get-dotnet-OnboardedDocsMsPackagesForMoniker function in Docs-ToC.sp1
2. Get-dotnet-PackageLevelReadme function in Docs-ToC.sp1
```
#>

Expand Down Expand Up @@ -38,3 +40,18 @@ Describe "Get-OnboardedDocsMsPackagesForMoniker" -Tag "UnitTest" {
$onboardingPackages.Value | Should -BeNullOrEmpty
}
}

# Test plan:
# 1. Tests on getting package level readme sucessfully.
Describe "Get-PackageLevelReadme" -Tag "UnitTest" {
# Passed cases
It "Get package level readme readme from package" -TestCases @(
@{ packageMetadataJson = "$PSScriptRoot/inputs/packageMetadata/1.json"; expectedPackageReadme="resourcemanager.hci" }
@{ packageMetadataJson = "$PSScriptRoot/inputs/packageMetadata/2.json"; expectedPackageReadme="storage.blobs" }
@{ packageMetadataJson = "$PSScriptRoot/inputs/packageMetadata/3.json"; expectedPackageReadme="microsoft.rest.clientruntime" }
) {
$packageMetadata = (Get-Content $packageMetadataJson -Raw) | ConvertFrom-Json
$packageReadme = Get-dotnet-PackageLevelReadme -packageMetadata $packageMetadata
$packageReadme | Should -Be $expectedPackageReadme
}
}
24 changes: 24 additions & 0 deletions eng/scripts/docs/tests/inputs/packageMetadata/1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"Package": "Azure.ResourceManager.Hci",
"VersionGA": "1.0.0",
"VersionPreview": "2.0.0-beta.1",
"DisplayName": "Resource Management - Azure Stack HCI",
"ServiceName": "Stack HCI",
"RepoPath": "azurestackhci",
"MSDocs": "",
"GHDocs": "",
"Type": "mgmt",
"New": "true",
"PlannedVersions": "",
"LatestGADate": "08/29/2022",
"FirstGADate": "08/29/2022",
"Support": "",
"EOLDate": "",
"Hide": "",
"Replace": "",
"ReplaceGuide": "",
"MSDocService": "",
"ServiceId": "",
"Notes": "",
"DirectoryPath": "sdk/azurestackhci/Azure.ResourceManager.Hci"
}
24 changes: 24 additions & 0 deletions eng/scripts/docs/tests/inputs/packageMetadata/2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"Package": "Azure.Storage.Blobs",
"VersionGA": "12.14.1",
"VersionPreview": "",
"DisplayName": "Storage - Blobs",
"ServiceName": "Storage",
"RepoPath": "storage",
"MSDocs": "",
"GHDocs": "",
"Type": "client",
"New": "true",
"PlannedVersions": "",
"LatestGADate": "10/20/2022",
"FirstGADate": "10/31/2019",
"Support": "active",
"EOLDate": "",
"Hide": "",
"Replace": "Microsoft.Azure.Storage.Blob",
"ReplaceGuide": "",
"MSDocService": "",
"ServiceId": "",
"Notes": "",
"DirectoryPath": "sdk/storage/Azure.Storage.Blobs"
}
23 changes: 23 additions & 0 deletions eng/scripts/docs/tests/inputs/packageMetadata/3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"Package": "Microsoft.Rest.ClientRuntime",
"VersionGA": "2.3.24",
"VersionPreview": "",
"DisplayName": "Client Runtime",
"ServiceName": "AutoRest",
"RepoPath": "",
"MSDocs": "NA",
"GHDocs": "NA",
"Type": "client",
"New": "False",
"PlannedVersions": "",
"LatestGADate": "",
"FirstGADate": "",
"Support": "active",
"EOLDate": "",
"Hide": "",
"Replace": "",
"ReplaceGuide": "",
"MSDocService": "",
"ServiceId": "",
"Notes": ""
}

0 comments on commit 7adc746

Please sign in to comment.