feat: add initial helper methods
This commit is contained in:
parent
81d80fcced
commit
76a93c0d8c
6 changed files with 1165 additions and 0 deletions
45
command_test.go
Normal file
45
command_test.go
Normal file
|
@ -0,0 +1,45 @@
|
|||
package sdk
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestCommandProperties_String(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
props := CommandProperties{"hello": "world"}
|
||||
if got, want := props.String(), "hello=world"; got != want {
|
||||
t.Errorf("expected %q to be %q", got, want)
|
||||
}
|
||||
|
||||
props["foo"] = "bar"
|
||||
if got, want := props.String(), "foo=bar,hello=world"; got != want {
|
||||
t.Errorf("expected %q to be %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommand_String(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cmd := Command{Name: "foo"}
|
||||
if got, want := cmd.String(), "::foo::"; got != want {
|
||||
t.Errorf("expected %q to be %q", got, want)
|
||||
}
|
||||
|
||||
cmd = Command{Name: "foo", Message: "bar"}
|
||||
if got, want := cmd.String(), "::foo::bar"; got != want {
|
||||
t.Errorf("expected %q to be %q", got, want)
|
||||
}
|
||||
|
||||
cmd = Command{
|
||||
Name: "foo",
|
||||
Message: "bar",
|
||||
Properties: CommandProperties{"bar": "foo"},
|
||||
}
|
||||
if got, want := cmd.String(), "::foo bar=foo::bar"; got != want {
|
||||
t.Errorf("expected %q to be %q", got, want)
|
||||
}
|
||||
|
||||
cmd = Command{Message: "quux"}
|
||||
if got, want := cmd.String(), "::missing.command::quux"; got != want {
|
||||
t.Errorf("expected %q to be %q", got, want)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue