From a7947a7cb74db53732ae49eaa36193aafbb2123f Mon Sep 17 00:00:00 2001 From: Kevin Schoon Date: Wed, 1 Sep 2021 08:56:22 -0400 Subject: [PATCH] apply some formatting fixes --- pkg/cmd/cmd_test.go | 58 +++++++++++++++++++++--------------------- pkg/internal/runner.go | 11 ++++---- pkg/internal/util.go | 1 - 3 files changed, 34 insertions(+), 36 deletions(-) diff --git a/pkg/cmd/cmd_test.go b/pkg/cmd/cmd_test.go index b7b7436..80df1de 100644 --- a/pkg/cmd/cmd_test.go +++ b/pkg/cmd/cmd_test.go @@ -12,39 +12,39 @@ import ( ) func checkErr(t *testing.T, err error) { - if err != nil { - t.Helper() - t.Fatal(err) - } + if err != nil { + t.Helper() + t.Fatal(err) + } } func initTestConfig(t *testing.T) (*pomo.Store, *pomo.Config) { - tmpPath, err := ioutil.TempDir(os.TempDir(), "pomo-test") - checkErr(t, err) - config := &pomo.Config{ - DateTimeFmt: "2006-01-02 15:04", - BasePath: tmpPath, - DBPath: filepath.Join(tmpPath, "pomo.db"), - SocketPath: filepath.Join(tmpPath, "pomo.sock"), - IconPath: filepath.Join(tmpPath, "icon.png"), - } - store, err := pomo.NewStore(config.DBPath) - checkErr(t, err) - checkErr(t, pomo.InitDB(store)) - return store, config + tmpPath, err := ioutil.TempDir(os.TempDir(), "pomo-test") + checkErr(t, err) + config := &pomo.Config{ + DateTimeFmt: "2006-01-02 15:04", + BasePath: tmpPath, + DBPath: filepath.Join(tmpPath, "pomo.db"), + SocketPath: filepath.Join(tmpPath, "pomo.sock"), + IconPath: filepath.Join(tmpPath, "icon.png"), + } + store, err := pomo.NewStore(config.DBPath) + checkErr(t, err) + checkErr(t, pomo.InitDB(store)) + return store, config } func TestPomoCreate(t *testing.T) { - store, config := initTestConfig(t) - cmd := New(config) - checkErr(t, cmd.Run([]string{"pomo", "create", "fuu"})) - // verify the task was created - store.With(func(tx *sql.Tx) error { - task, err := store.ReadTask(tx, 1) - checkErr(t, err) - if task.Message != "fuu" { - checkErr(t, fmt.Errorf("task should have message fuu, got %s", task.Message)) - } - return nil - }) + store, config := initTestConfig(t) + cmd := New(config) + checkErr(t, cmd.Run([]string{"pomo", "create", "fuu"})) + // verify the task was created + store.With(func(tx *sql.Tx) error { + task, err := store.ReadTask(tx, 1) + checkErr(t, err) + if task.Message != "fuu" { + checkErr(t, fmt.Errorf("task should have message fuu, got %s", task.Message)) + } + return nil + }) } diff --git a/pkg/internal/runner.go b/pkg/internal/runner.go index 3476549..3ce1276 100644 --- a/pkg/internal/runner.go +++ b/pkg/internal/runner.go @@ -126,7 +126,6 @@ func (t *TaskRunner) run() error { break } - t.notifier.Notify("Pomo", "It is time to take a break!") // Reset the duration incase it // was paused. @@ -150,10 +149,10 @@ func (t *TaskRunner) Pause() { func (t *TaskRunner) Status() *Status { return &Status{ - State: t.state, - Count: t.count, - NPomodoros: t.nPomodoros, - Remaining: t.TimeRemaining(), - Pauseduration: t.TimePauseDuration(), + State: t.state, + Count: t.count, + NPomodoros: t.nPomodoros, + Remaining: t.TimeRemaining(), + Pauseduration: t.TimePauseDuration(), } } diff --git a/pkg/internal/util.go b/pkg/internal/util.go index f8b0c5c..f830f2a 100644 --- a/pkg/internal/util.go +++ b/pkg/internal/util.go @@ -7,7 +7,6 @@ import ( "github.com/fatih/color" ) - func SummerizeTasks(config *Config, tasks []*Task) { for _, task := range tasks { var start string