-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathmain_menubar_test.go
More file actions
44 lines (37 loc) · 1.04 KB
/
main_menubar_test.go
File metadata and controls
44 lines (37 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"path/filepath"
"strings"
"testing"
"github.com/onllm-dev/onwatch/v2/internal/config"
)
func TestMenubarHelpText(t *testing.T) {
help := menubarHelpText()
for _, fragment := range []string{
"onWatch Menubar Companion",
"Usage: onwatch menubar [OPTIONS]",
"--port PORT",
"--debug",
"--help",
} {
if !strings.Contains(help, fragment) {
t.Fatalf("expected help text to contain %q, got %q", fragment, help)
}
}
}
func TestMenubarLogPath_UsesNewName(t *testing.T) {
dir := t.TempDir()
cfg := &config.Config{DBPath: filepath.Join(dir, "onwatch.db")}
want := filepath.Join(dir, "menubar.log")
if got := menubarLogPath(cfg); got != want {
t.Fatalf("menubarLogPath() = %q, want %q", got, want)
}
}
func TestMenubarLogPath_TestModeUsesNewTestName(t *testing.T) {
dir := t.TempDir()
cfg := &config.Config{DBPath: filepath.Join(dir, "onwatch.db"), TestMode: true}
want := filepath.Join(dir, "menubar-test.log")
if got := menubarLogPath(cfg); got != want {
t.Fatalf("menubarLogPath() = %q, want %q", got, want)
}
}