Skip to content

Commit 4077993

Browse files
committed
Added pester test for the external docs support
1 parent 2a1fc30 commit 4077993

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Authentication/Authentication/test/Find-MgGraphCommand.Tests.ps1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,25 @@ Describe "Find-MgGraphCommand Command" {
206206
$MgCommand[0].Command | Should -BeLike "New-MgApplication*"
207207
} | Should -Not -Throw
208208
}
209+
It 'Should find the API reference link' {
210+
{
211+
$MgCommand = Find-MgGraphCommand -Command "Get-MgUser"
212+
$MgCommand[0].APIReferenceLink | Should -Be "https://learn.microsoft.com/graph/api/users-get"
213+
} | Should -Not -Throw
214+
{
215+
$MgCommand = Find-MgGraphCommand -Command "Get-MgUser"
216+
$MgCommand | Should -HaveCount 2 # /users and /users/{id}.
217+
$MgCommand[0].Method | Select-Object -Unique | Should -Be "GET"
218+
$MgCommand[0].APIVersion | Select-Object -Unique | Should -Be "v1.0"
219+
$MgCommand[0].Command | Select-Object -Unique | Should -Be "Get-MgUser"
220+
} | Should -Not -Throw
221+
}
209222
It 'Should throw error when command name is invalid' {
210223
{
211224
Find-MgGraphCommand -Command "New-MgInvalid" -ErrorAction Stop | Out-Null
212225
} | Should -Throw -ExpectedMessage "*'New-MgInvalid' is not a valid Microsoft Graph PowerShell command.*"
213226
}
227+
214228
}
215229
}
216230
}

0 commit comments

Comments
 (0)