1package writefreely
2
3import (
4	"testing"
5
6	"github.com/writeas/web-core/activitystreams"
7)
8
9var actorTestTable = []struct {
10	Name string
11	Resp []byte
12}{
13	{
14		"Context as a string",
15		[]byte(`{"@context":"https://www.w3.org/ns/activitystreams"}`),
16	},
17	{
18		"Context as a list",
19		[]byte(`{"@context":["one string", "two strings"]}`),
20	},
21}
22
23func TestUnmarshalActor(t *testing.T) {
24	for _, tc := range actorTestTable {
25		actor := activitystreams.Person{}
26		err := unmarshalActor(tc.Resp, &actor)
27		if err != nil {
28			t.Errorf("%s failed with error %s", tc.Name, err)
29		}
30	}
31}
32