public/core/Update-MyCorpTests.ps1


<#
.SYNOPSIS
   Updates the specified folder with the latest ready-made MyCorp tests built by the MyCorp team.
 
.DESCRIPTION
    The MyCorp team maintains a repository of ready made tests that can be used to verify the configuration of your Microsoft 365 tenant.
 
    The tests can be viewed at https://github.com/mycorp365/mycorp/tree/main/tests
 
.PARAMETER Path
    The path to install or update the MyCorp tests in.
 
.EXAMPLE
    Update-MyCorpTests -Path .\mycorp-tests
 
    Installs or updates the latest MyCorp tests in the specified directory.
 
.EXAMPLE
    Update-MyCorpTests -Path .\
 
    Install the latest set of MyCorp tests in the current directory.
 
.LINK
    https://mycorp.dev/docs/commands/Update-MyCorpTests
#>

function Update-MyCorpTests {
    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Justification = 'Colors are beautiful')]
    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '', Justification = 'This command updates multiple tests')]
    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'TODO: Implement ShouldProcess')]
    [CmdletBinding()]
    param(
        # The path to install or update MyCorp tests in. Defaults to the current directory.
        [Parameter(Mandatory = $false)]
        [string] $Path = '.\',

        # Switch to control the toggling off of the "Are you sure?" prompt
        [Parameter(Mandatory = $false)]
        [switch] $Force
    )
    Write-Verbose 'Checking if newer version is availble.'
    Get-IsNewMyCorpVersionAvailable | Out-Null

    Write-Verbose "Updating MyCorp tests in '$Path'."
    Update-MtMyCorpTests -Path $Path -Force:$Force
}