pull/12/head v0.0.2
isthisnagee 3 years ago
parent d00ceceeec
commit ba188c53ee

@ -26,7 +26,7 @@ var listCmd = &cobra.Command{
q := model.GetDiaryEntriesQuery{} q := model.GetDiaryEntriesQuery{}
*num_entries = viper.GetInt64("listNumEntries") *num_entries = viper.GetInt64("listNumEntries")
if (*num_entries > 0) { if *num_entries > 0 {
q.NumEntries = num_entries q.NumEntries = num_entries
} }

@ -7,9 +7,9 @@ package cmd
import ( import (
"time" "time"
"github.com/spf13/viper"
"git.nagee.dev/isthisnagee/diary/model" "git.nagee.dev/isthisnagee/diary/model"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper"
) )
// todayCmd represents the today command // todayCmd represents the today command

@ -2,8 +2,8 @@ package model
import ( import (
"git.nagee.dev/isthisnagee/diary/db" "git.nagee.dev/isthisnagee/diary/db"
"testing"
"runtime/debug" "runtime/debug"
"testing"
) )
func assert_string(t *testing.T, expected string, actual string) { func assert_string(t *testing.T, expected string, actual string) {
@ -120,7 +120,6 @@ func TestGetDiaryEntries(t *testing.T) {
assert_int(t, result_2.Id, entries[0].Id) assert_int(t, result_2.Id, entries[0].Id)
assert_int(t, result_1.Id, entries[1].Id) assert_int(t, result_1.Id, entries[1].Id)
var numEntries = new(int64) var numEntries = new(int64)
*numEntries = 1 *numEntries = 1
entries = app.GetDiaryEntries( entries = app.GetDiaryEntries(
@ -132,6 +131,5 @@ func TestGetDiaryEntries(t *testing.T) {
assert_int(t, int64(len(entries)), 1) assert_int(t, int64(len(entries)), 1)
assert_int(t, result_2.Id, entries[0].Id) assert_int(t, result_2.Id, entries[0].Id)
teardown(app) teardown(app)
} }

Loading…
Cancel
Save