mirror of https://github.com/writeas/writefreely
A focused writing and publishing space.
https://write.with.parts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
574 B
32 lines
574 B
6 years ago
|
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)
|
||
|
}
|
||
|
}
|
||
|
}
|