tests/TMD.Hashing.Tests.ps1

BeforeAll {
    # Import the module file
    if (Get-Module 'TMD.Common') {
        Remove-Module 'TMD.Common' -Force
    }
    Import-Module "TMD.Common" -Force
}

Describe 'Get-StringHash' {
    It 'Outputs a string' {
        $HashString = Get-StringHash -String 'SomeString'
        $HashString | Should -BeOfType 'String'
    }

    It 'Converts to a MD5 hash' {
        $HashString = Get-StringHash -String 'SomeString'
        $HashString | Should -Be '8B-18-48-27-DE-FD-23-26-26-60-B2-1B-C4-93-93-ED'
    }

    It 'Outputs string in correct format' {
        $HashString = Get-StringHash -String 'SomeString'
        $HashString | Should -Match '(\w{2}-?){16}'
    }
}