apply some formatting fixes
This commit is contained in:
parent
1ad3c18c8a
commit
a7947a7cb7
|
@ -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
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
|
||||
func SummerizeTasks(config *Config, tasks []*Task) {
|
||||
for _, task := range tasks {
|
||||
var start string
|
||||
|
|
Loading…
Reference in New Issue