You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
979 B
42 lines
979 B
package keybase |
|
|
|
import ( |
|
"reflect" |
|
"strings" |
|
"testing" |
|
) |
|
|
|
func TestNewOptions(t *testing.T) { |
|
want := &Options{ |
|
KeybaseLoction: "", |
|
HomeDir: "", |
|
EnableTyping: false, |
|
BotLiteMode: true, |
|
} |
|
got := NewOptions() |
|
if !reflect.DeepEqual(want, got) { |
|
t.Errorf("NewOptions returned non-equal structs") |
|
} |
|
} |
|
|
|
func TestLocateKeybase(t *testing.T) { |
|
opts := NewOptions() |
|
opts.KeybaseLoction = "/usr/bin/keybase" |
|
if opts.locateKeybase() != "/usr/bin/keybase" { |
|
t.Errorf("locateKeybase returned non-specified keybase") |
|
} |
|
opts2 := NewOptions() |
|
if !strings.Contains(opts2.locateKeybase(), "keybase") { |
|
t.Errorf("locateKeybase did not return a keybase path") |
|
} |
|
} |
|
|
|
func TestBaseCommand(t *testing.T) { |
|
opts := NewOptions() |
|
opts.HomeDir = "/home/foo" |
|
want := []string{"--home", "/home/foo", "--enable-bot-lite-mode", "arg"} |
|
got := opts.buildArgs("arg") |
|
if !reflect.DeepEqual(want, got) { |
|
t.Errorf("buildBaseCommand returned invalid command set") |
|
} |
|
}
|
|
|