From 91dc9ce82f9cb5ca3e233013f8b0cccf3f0b4e5a Mon Sep 17 00:00:00 2001 From: Mohammed Sohail Date: Fri, 3 Jan 2025 11:10:07 +0300 Subject: [PATCH] tests: add sample pin/hash pair from migration dataset --- common/pin_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/common/pin_test.go b/common/pin_test.go index 1b11d2c..f10ad6b 100644 --- a/common/pin_test.go +++ b/common/pin_test.go @@ -99,6 +99,27 @@ func TestHashPIN(t *testing.T) { } } +func TestVerifyMigratedHashPin(t *testing.T) { + tests := []struct { + pin string + hash string + }{ + { + pin: "1234", + hash: "$2b$08$dTvIGxCCysJtdvrSnaLStuylPoOS/ZLYYkxvTeR5QmTFY3TSvPQC6", + }, + } + + for _, tt := range tests { + t.Run(tt.pin, func(t *testing.T) { + ok := VerifyPIN(tt.hash, tt.pin) + if !ok { + t.Errorf("VerifyPIN could not verify migrated PIN: %v", tt.pin, ok) + } + }) + } +} + func TestVerifyPIN(t *testing.T) { tests := []struct { name string