mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-06-07 10:53:07 +03:00
Message tests.
This commit is contained in:
parent
bcfacb89b1
commit
54b593ed47
34
chat/message_test.go
Normal file
34
chat/message_test.go
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package chat
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestMessage(t *testing.T) {
|
||||||
|
var expected, actual string
|
||||||
|
|
||||||
|
expected = " * foo"
|
||||||
|
actual = NewMessage("foo").String()
|
||||||
|
if actual != expected {
|
||||||
|
t.Errorf("Got: `%s`; Expected: `%s`", actual, expected)
|
||||||
|
}
|
||||||
|
|
||||||
|
u := NewUser("foo")
|
||||||
|
expected = "foo: hello"
|
||||||
|
actual = NewMessage("hello").From(u).String()
|
||||||
|
if actual != expected {
|
||||||
|
t.Errorf("Got: `%s`; Expected: `%s`", actual, expected)
|
||||||
|
}
|
||||||
|
|
||||||
|
expected = "-> hello"
|
||||||
|
actual = NewMessage("hello").To(u).String()
|
||||||
|
if actual != expected {
|
||||||
|
t.Errorf("Got: `%s`; Expected: `%s`", actual, expected)
|
||||||
|
}
|
||||||
|
|
||||||
|
expected = "[PM from foo] hello"
|
||||||
|
actual = NewMessage("hello").From(u).To(u).String()
|
||||||
|
if actual != expected {
|
||||||
|
t.Errorf("Got: `%s`; Expected: `%s`", actual, expected)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Add theme rendering tests
|
Loading…
x
Reference in New Issue
Block a user