Skip to content

Commit

Permalink
Assert-Feature: Fix unit tests (#1979)
Browse files Browse the repository at this point in the history
- `Assert-Feature`
  - Fixed unit tests.
  • Loading branch information
johlju authored Nov 22, 2023
1 parent e9639fd commit 22b25f6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Return SQLPS version as 12.0 instead of 120
- `Get-SqlDscPreferredModule`
- Fix sort to get the latest version
- `Assert-Feature`
- Fixed unit tests.

### Changed

Expand Down
24 changes: 17 additions & 7 deletions tests/Unit/Private/Assert-Feature.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,22 @@ Describe 'Assert-Feature' -Tag 'Private' {
}
}

It 'Should not throw an exception' {
InModuleScope -Parameters $_ -ScriptBlock {
It 'Should not throw an exception for a single feature' {
InModuleScope -ScriptBlock {
Set-StrictMode -Version 1.0

{
Assert-Feature -Feature 'RS' -ProductVersion 13
Assert-Feature -Feature 'RS' -ProductVersion '14'
} | Should -Not -Throw
}
}

It 'Should not throw an exception for multiple features' {
InModuleScope -ScriptBlock {
Set-StrictMode -Version 1.0

{
Assert-Feature -Feature 'RS', 'SQLENGINE' -ProductVersion '14'
} | Should -Not -Throw
}
}
Expand All @@ -75,7 +85,7 @@ Describe 'Assert-Feature' -Tag 'Private' {
Context 'When passing a single feature' {
Context 'When passing as a named parameter' {
It 'Should throw the correct error' {
InModuleScope -Parameters $_ -ScriptBlock {
InModuleScope -ScriptBlock {
Set-StrictMode -Version 1.0

{
Expand All @@ -87,7 +97,7 @@ Describe 'Assert-Feature' -Tag 'Private' {

Context 'When passing over the pipeline' {
It 'Should throw the correct error' {
InModuleScope -Parameters $_ -ScriptBlock {
InModuleScope -ScriptBlock {
Set-StrictMode -Version 1.0

{
Expand All @@ -101,7 +111,7 @@ Describe 'Assert-Feature' -Tag 'Private' {
Context 'When passing multiple features' {
Context 'When passing as a named parameter' {
It 'Should throw the correct error' {
InModuleScope -Parameters $_ -ScriptBlock {
InModuleScope -ScriptBlock {
Set-StrictMode -Version 1.0

{
Expand All @@ -113,7 +123,7 @@ Describe 'Assert-Feature' -Tag 'Private' {

Context 'When passing over the pipeline' {
It 'Should throw the correct error' {
InModuleScope -Parameters $_ -ScriptBlock {
InModuleScope -ScriptBlock {
Set-StrictMode -Version 1.0

{
Expand Down

0 comments on commit 22b25f6

Please sign in to comment.