+ describe "following / unfollowing" do
+ test "creates a follow activity" do
+ follower = insert(:user)
+ followed = insert(:user)
+
+ {:ok, activity} = ActivityPub.follow(follower, followed)
+ assert activity.data["type"] == "Follow"
+ assert activity.data["actor"] == follower.ap_id
+ assert activity.data["object"] == followed.ap_id
+ end
+
+ test "creates an undo activity for the last follow" do
+ follower = insert(:user)
+ followed = insert(:user)
+
+ {:ok, follow_activity} = ActivityPub.follow(follower, followed)
+ {:ok, activity} = ActivityPub.unfollow(follower, followed)
+
+ assert activity.data["type"] == "Undo"
+ assert activity.data["actor"] == follower.ap_id
+ assert activity.data["object"] == follow_activity.data["id"]
+ end
+ end
+