aboutsummaryrefslogtreecommitdiff
path: root/internal/watcher/watcher_test.go
diff options
context:
space:
mode:
authorSaiyed Shizain <saiyedshizain@gmail.com>2026-07-17 11:10:53 +0530
committerGitHub <noreply@github.com>2026-07-17 11:10:53 +0530
commit6afb80ab754da137939dd523ee419818026f9fb5 (patch)
treef9f94ec69ac87abe8060cefca8708572bc13bdd6 /internal/watcher/watcher_test.go
parentbcfb199ac8e5399e1a92cfbbc28af3674f80959d (diff)
parent5ae787be3d1d9de3355f8b5662fea857204e693c (diff)
downloadgalleryd-6afb80ab754da137939dd523ee419818026f9fb5.tar.xz
galleryd-6afb80ab754da137939dd523ee419818026f9fb5.zip
Merge pull request #11 from RanXom/feat/live-gallery
Feat/live-gallery: live gallery with automatic filesystem reloads
Diffstat (limited to 'internal/watcher/watcher_test.go')
-rw-r--r--internal/watcher/watcher_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/internal/watcher/watcher_test.go b/internal/watcher/watcher_test.go
new file mode 100644
index 0000000..53c0baa
--- /dev/null
+++ b/internal/watcher/watcher_test.go
@@ -0,0 +1,31 @@
+package watcher
+
+import (
+ "context"
+ "testing"
+ "time"
+)
+
+func TestRunReturnsOnContextCancellation(t *testing.T) {
+ w := New(Config{})
+
+ ctx, cancel := context.WithCancel(context.Background())
+
+ done := make(chan error, 1)
+
+ go func() {
+ done <- w.Run(ctx)
+ }()
+
+ cancel()
+
+ select {
+ case err := <-done:
+ if err != nil {
+ t.Fatalf("expected nil, got %v", err)
+ }
+
+ case <-time.After(time.Second):
+ t.Fatal("watcher did not exit")
+ }
+}