Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions utilities/pipelines/staticValidation/module.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
param (
[Parameter(Mandatory = $false)]
[array] $moduleFolderPaths = ((Get-ChildItem $repoRootPath -Recurse -Directory -Force).FullName | Where-Object {
(Get-ChildItem $_ -File -Depth 0 -Include @('deploy.json', 'deploy.bicep') -Force).Count -gt 0
(Get-ChildItem $_ -File -Depth 0 -Include @('deploy.json', 'deploy.bicep') -Force).Count -gt 0
}),

[Parameter(Mandatory = $false)]
Expand Down Expand Up @@ -80,31 +80,43 @@ Describe 'File/folder tests' -Tag 'Modules' {
}
}

It '[<moduleFolderName>] Module should contain a [`deploy.json`/`deploy.bicep`] file' -TestCases $moduleFolderTestCases {
It '[<moduleFolderName>] Module should contain a [` deploy.json ` / ` deploy.bicep `] file' -TestCases $moduleFolderTestCases {

param( [string] $moduleFolderPath )

$hasARM = (Test-Path (Join-Path -Path $moduleFolderPath 'deploy.json'))
$hasBicep = (Test-Path (Join-Path -Path $moduleFolderPath 'deploy.bicep'))
($hasARM -or $hasBicep) | Should -Be $true
$hasARM = Test-Path (Join-Path -Path $moduleFolderPath 'deploy.json')
$hasBicep = Test-Path (Join-Path -Path $moduleFolderPath 'deploy.bicep')
($hasARM -or $hasBicep) | Should -Be $true
}

It '[<moduleFolderName>] Module should contain a [`readme.md`] file' -TestCases $moduleFolderTestCases {
It '[<moduleFolderName>] Module should contain a [` readme.md `] file' -TestCases $moduleFolderTestCases {

param( [string] $moduleFolderPath )
(Test-Path (Join-Path -Path $moduleFolderPath 'readme.md')) | Should -Be $true
param(
[string] $moduleFolderPath
)

$pathExisting = Test-Path (Join-Path -Path $moduleFolderPath 'readme.md')
$pathExisting | Should -Be $true
}

It '[<moduleFolderName>] Module should contain a [`.test`] folder' -TestCases ($moduleFolderTestCases | Where-Object { $_.isTopLevelModule }) {
It '[<moduleFolderName>] Module should contain a [` .test `] folder' -TestCases ($moduleFolderTestCases | Where-Object { $_.isTopLevelModule }) {

param( [string] $moduleFolderPath )
Test-Path (Join-Path -Path $moduleFolderPath '.test') | Should -Be $true
param(
[string] $moduleFolderPath
)

$pathExisting = Test-Path (Join-Path -Path $moduleFolderPath '.test')
$pathExisting | Should -Be $true
}

It '[<moduleFolderName>] Module should contain a [`version.json`] file' -TestCases $moduleFolderTestCases {
It '[<moduleFolderName>] Module should contain a [` version.json `] file' -TestCases $moduleFolderTestCases {

param( [string] $moduleFolderPath )
(Test-Path (Join-Path -Path $moduleFolderPath 'version.json')) | Should -Be $true
param (
[string] $moduleFolderPath
)

$pathExisting = Test-Path (Join-Path -Path $moduleFolderPath 'version.json')
$pathExisting | Should -Be $true
}
}

Expand Down Expand Up @@ -824,7 +836,7 @@ Describe 'Deployment template tests' -Tag 'Template' {
$ApiVersionArray | Should -Not -Contain $false
}

It '[<moduleFolderName>] The template file should contain required elements: `schema`, `contentVersion`, `resources`' -TestCases $deploymentFolderTestCases {
It '[<moduleFolderName>] The template file should contain required elements: `schema`, `contentVersion`, `resources` ' -TestCases $deploymentFolderTestCases {

param(
[string] $moduleFolderName,
Expand Down Expand Up @@ -1154,7 +1166,7 @@ Describe 'Deployment template tests' -Tag 'Template' {
}
}

Describe 'API version tests' -Tag ApiCheck {
Describe 'API version tests' -Tag 'ApiCheck' {

$testCases = @()
$apiSpecsFilePath = Join-Path $repoRootPath 'utilities' 'src' 'apiSpecsList.json'
Expand Down