Skip to content

Commit

Permalink
Write a simple test for base64 encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Glatzer committed Aug 3, 2020
1 parent 09d915e commit 58760d0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ACME-PS/tests/A-Manual-Test-Run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ try {
$ModuleBase = Split-Path -Path $PSScriptRoot -Parent

Remove-Module ACME-PS -ErrorAction Ignore
Import-Module "$ModuleBase\ACME-PS.psd1" -ErrorAction 'Stop'
Import-Module "$ModuleBase\ACME-PS.psd1" -Force -ErrorAction 'Stop'

Invoke-Pester -Path "$ModuleBase\tests"
}
Expand Down
15 changes: 15 additions & 0 deletions ACME-PS/tests/UrlBase64.Tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
InModuleScope ACME-PS {
Context 'ConvertTo-Base64Url and ConvertFrom-Base64 url are roundtrippable' {
$value = [byte[]]@(131,251,190,1);

$base64Form = ConvertTo-UrlBase64 -InputBytes $value;
It 'Converted the input successfully' {
$base64Form | Should -Be "g_u-AQ";
}

$roundtripped = ConvertFrom-UrlBase64 $base64Form;
It 'Should match the orginial array' {
$roundtripped | Should -Be $value;
}
}
}

0 comments on commit 58760d0

Please sign in to comment.