mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
refactor(database): 🎨 Update database and schema names to be clearer
This commit is contained in:
parent
9081036c6d
commit
88b3ec7b43
92 changed files with 6785 additions and 1018 deletions
|
|
@ -124,68 +124,6 @@ describe("API Tests", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("POST /api/v1/accounts/:id/follow", () => {
|
||||
test("should follow the specified user and return an APIRelationship object", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`/api/v1/accounts/${user2.id}/follow`,
|
||||
base_url,
|
||||
),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.accessToken}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({}),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
const relationship = (await response.json()) as APIRelationship;
|
||||
|
||||
expect(relationship.id).toBe(user2.id);
|
||||
expect(relationship.following).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("POST /api/v1/accounts/:id/unfollow", () => {
|
||||
test("should unfollow the specified user and return an APIRelationship object", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`/api/v1/accounts/${user2.id}/unfollow`,
|
||||
base_url,
|
||||
),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.accessToken}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({}),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
const account = (await response.json()) as APIRelationship;
|
||||
|
||||
expect(account.id).toBe(user2.id);
|
||||
expect(account.following).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("POST /api/v1/accounts/:id/remove_from_followers", () => {
|
||||
test("should remove the specified user from the authenticated user's followers and return an APIRelationship object", async () => {
|
||||
const response = await sendTestRequest(
|
||||
|
|
@ -302,123 +240,6 @@ describe("API Tests", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("POST /api/v1/accounts/:id/mute with notifications parameter", () => {
|
||||
test("should mute the specified user and return an APIRelationship object with notifications set to false", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`/api/v1/accounts/${user2.id}/mute`,
|
||||
base_url,
|
||||
),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.accessToken}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ notifications: true }),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
const account = (await response.json()) as APIRelationship;
|
||||
|
||||
expect(account.id).toBe(user2.id);
|
||||
expect(account.muting).toBe(true);
|
||||
expect(account.muting_notifications).toBe(true);
|
||||
});
|
||||
|
||||
test("should mute the specified user and return an APIRelationship object with notifications set to true", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`/api/v1/accounts/${user2.id}/mute`,
|
||||
base_url,
|
||||
),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.accessToken}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ notifications: false }),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
const account = (await response.json()) as APIRelationship;
|
||||
|
||||
expect(account.id).toBe(user2.id);
|
||||
expect(account.muting).toBe(true);
|
||||
expect(account.muting_notifications).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("GET /api/v1/mutes", () => {
|
||||
test("should return an array of APIAccount objects for the user's muted accounts", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(wrapRelativeUrl("/api/v1/mutes", base_url), {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.accessToken}`,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
const body = (await response.json()) as APIAccount[];
|
||||
|
||||
expect(Array.isArray(body)).toBe(true);
|
||||
expect(body.length).toBe(1);
|
||||
expect(body[0].id).toBe(user2.id);
|
||||
});
|
||||
});
|
||||
|
||||
describe("POST /api/v1/accounts/:id/unmute", () => {
|
||||
test("should unmute the specified user and return an APIRelationship object", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`/api/v1/accounts/${user2.id}/unmute`,
|
||||
base_url,
|
||||
),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.accessToken}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({}),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
const account = (await response.json()) as APIRelationship;
|
||||
|
||||
expect(account.id).toBe(user2.id);
|
||||
expect(account.muting).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("POST /api/v1/accounts/:id/pin", () => {
|
||||
test("should pin the specified user and return an APIRelationship object", async () => {
|
||||
const response = await sendTestRequest(
|
||||
|
|
|
|||
|
|
@ -344,35 +344,6 @@ describe("API Tests", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("GET /api/v1/statuses/:id/favourited_by", () => {
|
||||
test("should return an array of User objects who favourited the specified status", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/statuses/${status?.id}/favourited_by`,
|
||||
base_url,
|
||||
),
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.accessToken}`,
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
const users = (await response.json()) as APIAccount[];
|
||||
|
||||
expect(users.length).toBe(1);
|
||||
expect(users[0].id).toBe(user.id);
|
||||
});
|
||||
});
|
||||
|
||||
describe("POST /api/v1/statuses/:id/unfavourite", () => {
|
||||
test("should unfavourite the specified status object", async () => {
|
||||
// Unfavourite the status
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue