1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-06-01 02:59:24 +02:00

Remove broken test, replace with simpler one

This commit is contained in:
binwiederhier 2023-02-27 14:07:06 -05:00
parent 7edcebad1f
commit 217ca81b17
2 changed files with 32 additions and 85 deletions

30
server/topic_test.go Normal file
View file

@ -0,0 +1,30 @@
package server
import (
"github.com/stretchr/testify/require"
"sync/atomic"
"testing"
)
func TestTopic_CancelSubscribers(t *testing.T) {
t.Parallel()
subFn := func(v *visitor, msg *message) error {
return nil
}
canceled1 := atomic.Bool{}
cancelFn1 := func() {
canceled1.Store(true)
}
canceled2 := atomic.Bool{}
cancelFn2 := func() {
canceled2.Store(true)
}
to := newTopic("mytopic")
to.Subscribe(subFn, "", cancelFn1)
to.Subscribe(subFn, "u_phil", cancelFn2)
to.CancelSubscribers("u_phil")
require.True(t, canceled1.Load())
require.False(t, canceled2.Load())
}