From bbf9efa82e96761f93b591e1a159ef7afb1f05c0 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sat, 20 Jun 2026 17:10:09 +0200 Subject: Add integration test TestRegisterAuthenticate This makes sure the implementations of Register() and Authenticate() are compatible. --- password_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/password_test.go b/password_test.go index a0dfbc3..12f7aaa 100644 --- a/password_test.go +++ b/password_test.go @@ -87,3 +87,26 @@ func TestAuthenticate(t *testing.T) { }) } } + +func TestRegisterAuthenticate(t *testing.T) { + for _, p := range passwords { + t.Run(p.description, func(t *testing.T) { + db, _ := emptyDB(t) + + err := MigrateToLatest(db) + if err != nil { + t.Fatalf("Could not execute function to test: %v", err) + } + + err = Register(db, p.username, p.password) + if err != nil { + t.Fatalf("Could not register user: %v", err) + } + + err = Authenticate(db, p.username, p.password) + if err != nil { + t.Fatalf("Failed to authenticate: %v", err) + } + }) + } +} -- cgit v1.3.1