mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-05-25 08:17:36 +02:00
Works
This commit is contained in:
parent
3eeeac2c13
commit
346d8d7967
8 changed files with 141 additions and 15 deletions
server
|
@ -4,6 +4,7 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestTopic_CancelSubscribers(t *testing.T) {
|
||||
|
@ -28,3 +29,13 @@ func TestTopic_CancelSubscribers(t *testing.T) {
|
|||
require.True(t, canceled1.Load())
|
||||
require.False(t, canceled2.Load())
|
||||
}
|
||||
|
||||
func TestTopic_Keepalive(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
to := newTopic("mytopic")
|
||||
to.lastAccess = time.Now().Add(-1 * time.Hour)
|
||||
to.Keepalive()
|
||||
require.True(t, to.LastAccess().Unix() >= time.Now().Unix()-2)
|
||||
require.True(t, to.LastAccess().Unix() <= time.Now().Unix()+2)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue