mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-08 02:17:25 +02:00
Use gg.V, slice.Map, chi's RequestSize, core/auth's encryption key and ClientIPRateLimiter instead of local copies; share the grant idle expiry constant and a Grant.LastActivity helper; pass last use as a time value.
24 lines
608 B
Go
24 lines
608 B
Go
package model_test
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/navidrome/navidrome/model"
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega"
|
|
)
|
|
|
|
var _ = Describe("Grant", func() {
|
|
Describe("LastActivity", func() {
|
|
created := time.Date(2026, 1, 1, 0, 0, 0, 0, time.UTC)
|
|
|
|
It("is the creation time for a grant never used", func() {
|
|
Expect(model.Grant{CreatedAt: created}.LastActivity()).To(Equal(created))
|
|
})
|
|
|
|
It("is the last use once the grant was used", func() {
|
|
used := created.Add(time.Hour)
|
|
Expect(model.Grant{CreatedAt: created, LastUsedAt: &used}.LastActivity()).To(Equal(used))
|
|
})
|
|
})
|
|
})
|