diff --git a/.github/workflows/Process-PSModule.yml b/.github/workflows/Process-PSModule.yml index 67f2c25..1181c77 100644 --- a/.github/workflows/Process-PSModule.yml +++ b/.github/workflows/Process-PSModule.yml @@ -4,6 +4,9 @@ on: workflow_dispatch: schedule: - cron: '0 0 * * *' + push: + branches: + - main pull_request: branches: - main @@ -13,19 +16,21 @@ on: - reopened - synchronize - labeled + - unlabeled concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: false permissions: - contents: write - pull-requests: write - statuses: write + contents: read pages: write id-token: write jobs: Process-PSModule: - uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@11117919e65242d3388727819a751f74ad24ea9e # v5.5.0 - secrets: inherit + uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v8 + secrets: + PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }} + GitHubAppClientId: ${{ secrets.SHELLY_CLIENT_ID }} + GitHubAppPrivateKey: ${{ secrets.SHELLY_PRIVATE_KEY }} diff --git a/tests/Fonts.Tests.ps1 b/tests/Fonts.Tests.ps1 index a318089..7074ab6 100644 --- a/tests/Fonts.Tests.ps1 +++ b/tests/Fonts.Tests.ps1 @@ -1,66 +1,71 @@ -Describe 'Fonts' { +#Requires -Modules @{ ModuleName = 'Pester'; ModuleVersion = '6.1.0'; MaximumVersion = '6.*' } + +[Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSUseDeclaredVarsMoreThanAssignments', '', + Justification = 'Required for Pester tests' +)] +[CmdletBinding()] +param() + +Describe 'Fonts' { Context 'Function: Get-Font' { It 'The function should be available' { - Get-Command -Name 'Get-Font' | Should -Not -BeNull + Get-Command -Name 'Get-Font' | Should-NotBeNull } Context 'CurrentUser' { It 'Should return a list of fonts' { - { - $fonts = Get-Font -Verbose - Write-Verbose ($fonts | Out-String) -Verbose - } | Should -Not -Throw + $fonts = Get-Font -Verbose + Write-Verbose ($fonts | Out-String) -Verbose } } Context 'AllUsers' { It 'Should return a list of fonts' { - { - $fonts = Get-Font -Scope AllUsers -Verbose - Write-Verbose ($fonts | Out-String) -Verbose - } | Should -Not -Throw + $fonts = Get-Font -Scope AllUsers -Verbose + Write-Verbose ($fonts | Out-String) -Verbose } } } Context 'Function: Install-Font' { It 'Should be available' { - Get-Command -Name 'Install-Font' | Should -Not -BeNull + Get-Command -Name 'Install-Font' | Should-NotBeNull } It 'Should install a font' { $fontPath = Join-Path -Path $PSScriptRoot -ChildPath 'Fonts/CascadiaCodePL.ttf' - { Install-Font -Path $fontPath -Verbose } | Should -Not -Throw + Install-Font -Path $fontPath -Verbose Write-Verbose "Installed font: 'CascadiaCodePL'" -Verbose Write-Verbose (Get-Font | Out-String) -Verbose } It "Should return the installed font 'CascadiaCodePL'" { $font = Get-Font -Name 'CascadiaCodePL' Write-Verbose ($font | Out-String) -Verbose - $font | Should -Not -BeNullOrEmpty + $font | Should-NotBeNull } } Context 'Function: Uninstall-Font' { It 'Should be available' { - Get-Command -Name 'Uninstall-Font' | Should -Not -BeNull + Get-Command -Name 'Uninstall-Font' | Should-NotBeNull } It 'Should uninstall a font' { - { Uninstall-Font -Name 'CascadiaCodePL' -Verbose } | Should -Not -Throw + Uninstall-Font -Name 'CascadiaCodePL' -Verbose } It 'Should NOT return the uninstalled font' { $font = Get-Font -Name 'CascadiaCodePL' Write-Verbose ($font | Out-String) -Verbose - $font | Should -BeNullOrEmpty + $font | Should-BeNull } It 'Should install and uninstall a font based on wildcard' { $fontPath = Join-Path -Path $PSScriptRoot -ChildPath 'Fonts/CascadiaCodePL.ttf' - { Install-Font -Path $fontPath -Verbose } | Should -Not -Throw + Install-Font -Path $fontPath -Verbose Write-Verbose "Installed font: 'CascadiaCodePL'" -Verbose Write-Verbose (Get-Font | Out-String) -Verbose - { Uninstall-Font -Name 'CascadiaCode*' -Verbose } | Should -Not -Throw + Uninstall-Font -Name 'CascadiaCode*' -Verbose $font = Get-Font -Name 'CascadiaCodePL' Write-Verbose ($font | Out-String) -Verbose - $font | Should -BeNullOrEmpty + $font | Should-BeNull } } }