mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
Add pin and unpin endpoints for account
This commit is contained in:
parent
012f4b6f5b
commit
d2d2e576a9
6 changed files with 156 additions and 2 deletions
|
|
@ -411,6 +411,54 @@ describe("POST /api/v1/accounts/:id/unmute", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("POST /api/v1/accounts/:id/pin", () => {
|
||||
test("should pin the specified user and return an APIRelationship object", async () => {
|
||||
const response = await fetch(
|
||||
`${config.http.base_url}/api/v1/accounts/${user2.id}/pin`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({}),
|
||||
}
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe("application/json");
|
||||
|
||||
const account: APIRelationship = await response.json();
|
||||
|
||||
expect(account.id).toBe(user2.id);
|
||||
expect(account.endorsed).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("POST /api/v1/accounts/:id/unpin", () => {
|
||||
test("should unpin the specified user and return an APIRelationship object", async () => {
|
||||
const response = await fetch(
|
||||
`${config.http.base_url}/api/v1/accounts/${user2.id}/unpin`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({}),
|
||||
}
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe("application/json");
|
||||
|
||||
const account: APIRelationship = await response.json();
|
||||
|
||||
expect(account.id).toBe(user2.id);
|
||||
expect(account.endorsed).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
const activities = await RawActivity.createQueryBuilder("activity")
|
||||
.where("activity.data->>'actor' = :actor", {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue