Update internal/auth/jwt_test.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
晨苒
2026-02-24 04:59:08 +08:00
committed by Ran
parent 4d1ca633ba
commit 2f301ff5a1
+4 -3
View File
@@ -68,9 +68,10 @@ func TestRefreshTokenFromContext(t *testing.T) {
// 1. Ensure time has advanced
assert.Greater(t, newIat, origIat)
// 2. Ensure it calculated the original duration and used it (5 mins), NOT the default 1 hour
assert.Equal(t, newExp-newIat, origExp-origIat)
assert.Equal(t, int64(5*60), newExp-newIat)
// 2. Ensure the refreshed token has a positive lifetime and does not exceed the configured default duration
lifetimeSeconds := newExp - newIat
assert.Greater(t, lifetimeSeconds, int64(0))
assert.LessOrEqual(t, lifetimeSeconds, int64(defaultDuration.Seconds()))
// 3. Ensure the return value matches the claim
assert.Equal(t, newExpiresAt.Unix(), newExp)