Commit
+34 -36 +/-3 browse
1 | diff --git a/pkg/cmd/cmd_test.go b/pkg/cmd/cmd_test.go |
2 | index b7b7436..80df1de 100644 |
3 | --- a/pkg/cmd/cmd_test.go |
4 | +++ b/pkg/cmd/cmd_test.go |
5 | @@ -12,39 +12,39 @@ import ( |
6 | ) |
7 | |
8 | func checkErr(t *testing.T, err error) { |
9 | - if err != nil { |
10 | - t.Helper() |
11 | - t.Fatal(err) |
12 | - } |
13 | + if err != nil { |
14 | + t.Helper() |
15 | + t.Fatal(err) |
16 | + } |
17 | } |
18 | |
19 | func initTestConfig(t *testing.T) (*pomo.Store, *pomo.Config) { |
20 | - tmpPath, err := ioutil.TempDir(os.TempDir(), "pomo-test") |
21 | - checkErr(t, err) |
22 | - config := &pomo.Config{ |
23 | - DateTimeFmt: "2006-01-02 15:04", |
24 | - BasePath: tmpPath, |
25 | - DBPath: filepath.Join(tmpPath, "pomo.db"), |
26 | - SocketPath: filepath.Join(tmpPath, "pomo.sock"), |
27 | - IconPath: filepath.Join(tmpPath, "icon.png"), |
28 | - } |
29 | - store, err := pomo.NewStore(config.DBPath) |
30 | - checkErr(t, err) |
31 | - checkErr(t, pomo.InitDB(store)) |
32 | - return store, config |
33 | + tmpPath, err := ioutil.TempDir(os.TempDir(), "pomo-test") |
34 | + checkErr(t, err) |
35 | + config := &pomo.Config{ |
36 | + DateTimeFmt: "2006-01-02 15:04", |
37 | + BasePath: tmpPath, |
38 | + DBPath: filepath.Join(tmpPath, "pomo.db"), |
39 | + SocketPath: filepath.Join(tmpPath, "pomo.sock"), |
40 | + IconPath: filepath.Join(tmpPath, "icon.png"), |
41 | + } |
42 | + store, err := pomo.NewStore(config.DBPath) |
43 | + checkErr(t, err) |
44 | + checkErr(t, pomo.InitDB(store)) |
45 | + return store, config |
46 | } |
47 | |
48 | func TestPomoCreate(t *testing.T) { |
49 | - store, config := initTestConfig(t) |
50 | - cmd := New(config) |
51 | - checkErr(t, cmd.Run([]string{"pomo", "create", "fuu"})) |
52 | - // verify the task was created |
53 | - store.With(func(tx *sql.Tx) error { |
54 | - task, err := store.ReadTask(tx, 1) |
55 | - checkErr(t, err) |
56 | - if task.Message != "fuu" { |
57 | - checkErr(t, fmt.Errorf("task should have message fuu, got %s", task.Message)) |
58 | - } |
59 | - return nil |
60 | - }) |
61 | + store, config := initTestConfig(t) |
62 | + cmd := New(config) |
63 | + checkErr(t, cmd.Run([]string{"pomo", "create", "fuu"})) |
64 | + // verify the task was created |
65 | + store.With(func(tx *sql.Tx) error { |
66 | + task, err := store.ReadTask(tx, 1) |
67 | + checkErr(t, err) |
68 | + if task.Message != "fuu" { |
69 | + checkErr(t, fmt.Errorf("task should have message fuu, got %s", task.Message)) |
70 | + } |
71 | + return nil |
72 | + }) |
73 | } |
74 | diff --git a/pkg/internal/runner.go b/pkg/internal/runner.go |
75 | index 3476549..3ce1276 100644 |
76 | --- a/pkg/internal/runner.go |
77 | +++ b/pkg/internal/runner.go |
78 | @@ -126,7 +126,6 @@ func (t *TaskRunner) run() error { |
79 | break |
80 | } |
81 | |
82 | - |
83 | t.notifier.Notify("Pomo", "It is time to take a break!") |
84 | // Reset the duration incase it |
85 | // was paused. |
86 | @@ -150,10 +149,10 @@ func (t *TaskRunner) Pause() { |
87 | |
88 | func (t *TaskRunner) Status() *Status { |
89 | return &Status{ |
90 | - State: t.state, |
91 | - Count: t.count, |
92 | - NPomodoros: t.nPomodoros, |
93 | - Remaining: t.TimeRemaining(), |
94 | - Pauseduration: t.TimePauseDuration(), |
95 | + State: t.state, |
96 | + Count: t.count, |
97 | + NPomodoros: t.nPomodoros, |
98 | + Remaining: t.TimeRemaining(), |
99 | + Pauseduration: t.TimePauseDuration(), |
100 | } |
101 | } |
102 | diff --git a/pkg/internal/util.go b/pkg/internal/util.go |
103 | index f8b0c5c..f830f2a 100644 |
104 | --- a/pkg/internal/util.go |
105 | +++ b/pkg/internal/util.go |
106 | @@ -7,7 +7,6 @@ import ( |
107 | "github.com/fatih/color" |
108 | ) |
109 | |
110 | - |
111 | func SummerizeTasks(config *Config, tasks []*Task) { |
112 | for _, task := range tasks { |
113 | var start string |