aboutsummaryrefslogtreecommitdiff
path: root/watcher_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-10-17 19:14:20 +0700
committerShulhan <ms@kilabit.info>2021-10-17 19:14:20 +0700
commit36d729c71dd03303a2eef4cfefa64ac1a78a0ec1 (patch)
tree451649d9eaecd20b466a4a4d56a393410fbf8713 /watcher_test.go
parent56488e32c04c4561d06d3446b81bb726d5cbb6ff (diff)
downloadciigo-36d729c71dd03303a2eef4cfefa64ac1a78a0ec1.tar.xz
all: fix empty fileMarkups on watcher
Previously, when user call ciigo.Watch(), and the markup file changes, the onChangeFileMarkup method will print an error "xyz not found" which cause the markup file not converted. This is caused by watcher.fileMarkups is empty. This changes fix this issue by initializing the fileMarkups field using listFileMarkups, so the next callback to onChangeFileMarkup can detect the changed file and convert it.
Diffstat (limited to 'watcher_test.go')
-rw-r--r--watcher_test.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/watcher_test.go b/watcher_test.go
index 3bc7c31..98b7eb1 100644
--- a/watcher_test.go
+++ b/watcher_test.go
@@ -42,7 +42,15 @@ func TestWatcher(t *testing.T) {
t.Fatal(err)
}
- testWatcher, err = newWatcher(htmlg, testDir, "")
+ convertOpts := ConvertOptions{
+ Root: testDir,
+ }
+ err = convertOpts.init()
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ testWatcher, err = newWatcher(htmlg, &convertOpts)
if err != nil {
t.Fatal(err)
}