2021-06-08 22:57:19 +02:00
|
|
|
package utils_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/navidrome/navidrome/utils"
|
2022-07-26 22:47:16 +02:00
|
|
|
. "github.com/onsi/ginkgo/v2"
|
2021-06-08 22:57:19 +02:00
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ = Describe("IsCtxDone", func() {
|
|
|
|
It("returns false if the context is not done", func() {
|
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
defer cancel()
|
|
|
|
Expect(utils.IsCtxDone(ctx)).To(BeFalse())
|
|
|
|
})
|
|
|
|
|
|
|
|
It("returns true if the context is done", func() {
|
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
cancel()
|
|
|
|
Expect(utils.IsCtxDone(ctx)).To(BeTrue())
|
|
|
|
})
|
|
|
|
})
|