Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jazuntee committed Jan 25, 2023
1 parent 7306284 commit ba10f8c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build/PesterConfiguration.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
}
Filter = @{
#Tag = 'Debug'
ExcludeTag = 'IntegrationTest'
#ExcludeTag = 'IntegrationTest'
}
CodeCoverage = @{
Enabled = $true
Expand Down
6 changes: 3 additions & 3 deletions tests/Integration.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Describe 'MgCommand' -Tag 'IntegrationTest' {
## Mock commands with external dependancies or unavailable commands
# ToDo: Integration test should perform real authentication and module import
Mock -ModuleName $PSModule.Name Get-MgContext { New-Object Microsoft.Graph.PowerShell.Authentication.AuthContext -Property @{ Scopes = @('email', 'openid', 'profile', 'User.Read', 'User.Read.All'); AppName = 'Microsoft Graph PowerShell'; PSHostVersion = $PSVersionTable['PSVersion'] } } -Verifiable
Mock -ModuleName $PSModule.Name Import-Module { } -Verifiable
Mock -ModuleName $PSModule.Name Import-Module { } -ParameterFilter { $Name -ne 'Microsoft.Graph.Authentication' } -Verifiable

## Test Cases
$TestCases = @(
Expand Down Expand Up @@ -121,8 +121,8 @@ Describe 'MgCommand' -Tag 'IntegrationTest' {

Context 'Error Conditions' {
BeforeAll {
Mock -ModuleName $PSModule.Name Import-Module { Import-Module 'Microsoft.Graph.ModuleNotFound' -ErrorAction SilentlyContinue } -Verifiable
Mock -ModuleName $PSModule.Name Import-Module { Import-Module 'Microsoft.Graph.ModuleNotFound' -ErrorAction Stop } -ParameterFilter { $ErrorAction -eq 'Stop' } -Verifiable
Mock -ModuleName $PSModule.Name Import-Module { Import-Module 'Microsoft.Graph.ModuleNotFound' -ErrorAction SilentlyContinue } -ParameterFilter { $Name -ne 'Microsoft.Graph.Authentication' } -Verifiable
Mock -ModuleName $PSModule.Name Import-Module { Import-Module 'Microsoft.Graph.ModuleNotFound' -ErrorAction Stop } -ParameterFilter { $ErrorAction -eq 'Stop' -and $Name -ne 'Microsoft.Graph.Authentication' } -Verifiable
Mock -ModuleName $PSModule.Name Get-MgContext { } -Verifiable
}

Expand Down

0 comments on commit ba10f8c

Please sign in to comment.