Skip to content

Commit d1187d3

Browse files
committed
add test
1 parent 21dc656 commit d1187d3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

extensions/bicep/bicep.tests.ps1

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
BeforeDiscovery {
5+
$foundBicep = if ($null -ne (Get-Command bicep -ErrorAction Ignore)) {
6+
$true
7+
} else {
8+
$false
9+
}
10+
}
11+
12+
Describe 'Bicep extension tests' -Skip:(!$foundBicep) {
13+
It 'Example bicep file should work' {
14+
$bicepFile = Resolve-Path -Path "$PSScriptRoot\..\..\dsc\examples\hello_world.dsc.bicep"
15+
$out = dsc -l debug config get -f $bicepFile 2>$TestDrive/error.log | ConvertFrom-Json
16+
$LASTEXITCODE | Should -Be 0 -Because (Get-Content -Path $TestDrive/error.log -Raw | Out-String)
17+
$out.results[0].result.actualState.output | Should -BeExactly 'Hello, world!'
18+
(Get-Content -Path $TestDrive/error.log -Raw) | Should -Match "Importing file '$bicepFile' with extension 'Microsoft.DSC.Extension/Bicep'"
19+
}
20+
}

0 commit comments

Comments
 (0)