29 lines
630 B
Go
29 lines
630 B
Go
package lishwist_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"lishwist/core/internal/fixtures"
|
|
)
|
|
|
|
func TestMakeWish(t *testing.T) {
|
|
s := fixtures.Login("thomas", "123")
|
|
|
|
if err := s.MakeWish("apple"); err != nil {
|
|
t.Fatalf("Failed to make wish 1: %s\n", err)
|
|
}
|
|
|
|
if err := s.MakeWish(" A car "); err != nil {
|
|
t.Fatalf("Failed to make wish 2: %s\n", err)
|
|
}
|
|
|
|
wishes, err := s.GetWishes()
|
|
if err != nil {
|
|
t.Fatalf("Failed to get wishes: %s\n", err)
|
|
}
|
|
|
|
fixtures.AssertEq(t, "Number of wishes", 2, len(wishes))
|
|
fixtures.AssertEq(t, "Wish 1 name", wishes[0].Name, "apple")
|
|
fixtures.AssertEq(t, "Wish 2 name", wishes[1].Name, "A car")
|
|
}
|