40 lines
1 KiB
Go
40 lines
1 KiB
Go
package mlp_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.fromouter.space/mcg/draft"
|
|
"git.fromouter.space/mcg/draft/mlp"
|
|
)
|
|
|
|
// TestSet retrieves a set online and generates a couple packs with it
|
|
// This test *requires* an internet connection!
|
|
func TestSet(t *testing.T) {
|
|
deSet, err := mlp.LoadSetHTTP(mlp.SetDefendersOfEquestria)
|
|
if err != nil {
|
|
t.Errorf("Could not fetch set data: %s", err.Error())
|
|
}
|
|
|
|
pack1 := draft.MakePack(deSet)
|
|
pack2 := draft.MakePack(deSet)
|
|
|
|
// Make sure both packs have the exact number of cards
|
|
if len(pack1) != 12 {
|
|
t.Errorf("Expected 12 cards in pack 1 but got %d", len(pack1))
|
|
}
|
|
if len(pack2) != 12 {
|
|
t.Errorf("Expected 12 cards in pack 2 but got %d", len(pack2))
|
|
}
|
|
|
|
t.Logf("Cards in pack 1: %s\n", pack1)
|
|
t.Logf("Cards in pack 2: %s\n", pack2)
|
|
}
|
|
|
|
// TestWrongSet tries to fetch a set that doesn't exist
|
|
// This test *requires* an internet connection!
|
|
func TestWrongSet(t *testing.T) {
|
|
_, err := mlp.LoadSetHTTP("nopenope")
|
|
if err == nil {
|
|
t.Errorf("Expected an error but didn't get one!")
|
|
}
|
|
}
|