feat: we made it better...aka i did too many things and don't remember

This commit is contained in:
Stevan Freeborn
2026-08-15 10:48:29 -05:00
parent 5c5a126d88
commit c3fded4492
14 changed files with 919 additions and 72 deletions
+21
View File
@@ -0,0 +1,21 @@
package auth_test
import (
"testing"
"time"
"github.com/StevanFreeborn/chirpy/internal/auth"
"github.com/google/uuid"
)
func TestJwtCreationAndValidation(t *testing.T) {
userId := uuid.New()
secret := []byte("RTCK2UTcOUkiswdrClC6Z3KmmEq/+QicpD9iRx7J0qY=")
jwtString, err := auth.MakeJWT(userId, secret, time.Hour)
validatedUserId, err := auth.ValidateJWT(jwtString, secret)
if userId != validatedUserId {
t.Fatalf("received %s expected %s: %v", validatedUserId, userId, err)
}
}