-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclock_test.go
More file actions
32 lines (24 loc) · 795 Bytes
/
clock_test.go
File metadata and controls
32 lines (24 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2026 Hyperscale. All rights reserved.
// Use of this source code is governed by a MIT
// license that can be found in the LICENSE file.
package security_test
import (
"testing"
"time"
"github.com/hyperscale-stack/security"
"github.com/stretchr/testify/assert"
)
func TestSystemClockReturnsCurrentTime(t *testing.T) {
t.Parallel()
clock := security.SystemClock{}
before := time.Now()
got := clock.Now()
after := time.Now()
assert.False(t, got.Before(before), "Now() must not predate the call site")
assert.False(t, got.After(after), "Now() must not postdate the call site")
}
func TestDefaultClockIsSystemClock(t *testing.T) {
t.Parallel()
_, ok := security.DefaultClock.(security.SystemClock)
assert.True(t, ok, "DefaultClock should be a SystemClock value")
}