test: replace mock pkg/clock with narrowly targeted stub clocks. (#3238)

The package under pkg/clock is github.com/benbjohnson/clock, which is
archived. It's also way more complex than is what is actually needed
here, so we can entirely remove the dependency and remove the helper
package.

Fixes #2840.

Signed-off-by: David Symonds <dsymonds@gmail.com>
This commit is contained in:
David Symonds
2025-10-28 10:05:02 +01:00
committed by GitHub
parent 8f687e4d0c
commit 110d51d1d7
13 changed files with 50 additions and 594 deletions
+3 -2
View File
@@ -17,8 +17,9 @@ func TestRefresh(t *testing.T) {
now := time.Unix(1234567890, 10)
expires := time.Unix(1234567890, 0)
ss := &sessions.SessionState{}
ss.Clock.Set(now)
ss := &sessions.SessionState{
Clock: func() time.Time { return now },
}
ss.SetExpiresOn(expires)
refreshed, err := p.RefreshSession(context.Background(), ss)