2021-07-26 06:59:31 +02:00
|
|
|
package command_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"git.ewintr.nl/go-kit/test"
|
|
|
|
"git.ewintr.nl/gte/cmd/cli/command"
|
|
|
|
"git.ewintr.nl/gte/internal/configuration"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestCommand(t *testing.T) {
|
|
|
|
for _, tc := range []struct {
|
|
|
|
name string
|
|
|
|
args []string
|
|
|
|
exp string
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "empty",
|
|
|
|
exp: "empty",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "sync",
|
|
|
|
args: []string{"sync"},
|
|
|
|
exp: "sync",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "today",
|
|
|
|
args: []string{"today"},
|
|
|
|
exp: "today",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "tomorrow",
|
|
|
|
args: []string{"tomorrow"},
|
|
|
|
exp: "tomorrow",
|
|
|
|
},
|
2021-07-27 07:10:01 +02:00
|
|
|
{
|
|
|
|
name: "show task",
|
|
|
|
args: []string{"123"},
|
|
|
|
exp: "show",
|
|
|
|
},
|
2021-07-26 06:59:31 +02:00
|
|
|
{
|
|
|
|
name: "done",
|
2021-07-28 07:09:39 +02:00
|
|
|
args: []string{"123", "done"},
|
2021-07-26 06:59:31 +02:00
|
|
|
exp: "done",
|
|
|
|
},
|
|
|
|
} {
|
|
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
|
|
cmd, _ := command.Parse(tc.args, &configuration.Configuration{})
|
|
|
|
test.Equals(t, tc.exp, cmd.Cmd())
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|