Skip to content

Commit

Permalink
module date validation
Browse files Browse the repository at this point in the history
  • Loading branch information
jworkmanjc committed Oct 4, 2023
1 parent adca808 commit 247287c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion PowerShell/JumpCloud Module/JumpCloud.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: JumpCloud Solutions Architect Team
#
# Generated on: 10/3/2023
# Generated on: 10/4/2023
#

@{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,11 @@ Describe -Tag:('ModuleValidation') 'Module Manifest Tests' {
}
}
}
It 'When Update-ModuleManifest is run, no changes in the current branch are behind' {
It 'The date on the current version of the Module Manifest file should be todays date' {
# update module manifest
Update-ModuleManifest -Path:($FilePath_psd1)
$diff = git diff -- $FilePath_psd1
if ($diff) {
write-warning "diff found in file: $FilePath_psd1 when we expected none to exist; have you run `Update-ModuleManifest -Path /src/PowerShell/JumpCloud Module/JumpCloud.psd1` and committed the resulting changes?"
}
$diff | Should -BeNullOrEmpty
$moduleContent = Get-COntent -Path ("$FilePath_psd1")
# get content from current path
$moduleContent = Get-Content -Path ("$FilePath_psd1")
$stringMatch = Select-String -InputObject $moduleContent -Pattern "# Generated on: ([\d]+\/[\d]+\/[\d]+)"
$PSD1_date = $stringMatch.matches.groups[1].value
([datetime]$PSD1_date) | Should -Be ([datetime]( Get-Date -Format "M/d/yyyy" ))
Expand Down

0 comments on commit 247287c

Please sign in to comment.