mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-28 17:03:58 +08:00
commands: Fixed tests
This commit is contained in:

committed by
Juan Batiz-Benet

parent
8ee3e996cc
commit
ce28fa363b
@ -2,13 +2,17 @@ package commands
|
|||||||
|
|
||||||
import "testing"
|
import "testing"
|
||||||
|
|
||||||
|
func noop(req Request) (interface{}, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
func TestOptionValidation(t *testing.T) {
|
func TestOptionValidation(t *testing.T) {
|
||||||
cmd := Command{
|
cmd := Command{
|
||||||
Options: []Option{
|
Options: []Option{
|
||||||
Option{[]string{"b", "beep"}, Int, "enables beeper"},
|
Option{[]string{"b", "beep"}, Int, "enables beeper"},
|
||||||
Option{[]string{"B", "boop"}, String, "password for booper"},
|
Option{[]string{"B", "boop"}, String, "password for booper"},
|
||||||
},
|
},
|
||||||
Run: func(res Response, req Request) {},
|
Run: noop,
|
||||||
}
|
}
|
||||||
|
|
||||||
req := NewEmptyRequest()
|
req := NewEmptyRequest()
|
||||||
@ -79,8 +83,6 @@ func TestOptionValidation(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRegistration(t *testing.T) {
|
func TestRegistration(t *testing.T) {
|
||||||
noop := func(res Response, req Request) {}
|
|
||||||
|
|
||||||
cmdA := &Command{
|
cmdA := &Command{
|
||||||
Options: []Option{
|
Options: []Option{
|
||||||
Option{[]string{"beep"}, Int, "number of beeps"},
|
Option{[]string{"beep"}, Int, "number of beeps"},
|
||||||
|
Reference in New Issue
Block a user