mirror of
https://github.com/writefreely/writefreely
synced 2024-11-10 19:34:19 +00:00
32 lines
574 B
Go
32 lines
574 B
Go
|
package writefreely
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/writeas/web-core/activitystreams"
|
||
|
)
|
||
|
|
||
|
var actorTestTable = []struct {
|
||
|
Name string
|
||
|
Resp []byte
|
||
|
}{
|
||
|
{
|
||
|
"Context as a string",
|
||
|
[]byte(`{"@context":"https://www.w3.org/ns/activitystreams"}`),
|
||
|
},
|
||
|
{
|
||
|
"Context as a list",
|
||
|
[]byte(`{"@context":["one string", "two strings"]}`),
|
||
|
},
|
||
|
}
|
||
|
|
||
|
func TestUnmarshalActor(t *testing.T) {
|
||
|
for _, tc := range actorTestTable {
|
||
|
actor := activitystreams.Person{}
|
||
|
err := unmarshalActor(tc.Resp, &actor)
|
||
|
if err != nil {
|
||
|
t.Errorf("%s failed with error %s", tc.Name, err)
|
||
|
}
|
||
|
}
|
||
|
}
|