mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
Replace eslint and prettier with Biome
This commit is contained in:
parent
4a5a2ea590
commit
af0d627f19
199 changed files with 16493 additions and 16361 deletions
|
|
@ -1,11 +1,11 @@
|
|||
import type { Token } from "@prisma/client";
|
||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Token } from "@prisma/client";
|
||||
import { config } from "config-manager";
|
||||
import { client } from "~database/datasource";
|
||||
import { TokenType } from "~database/entities/Token";
|
||||
import {
|
||||
type UserWithRelations,
|
||||
createNewLocalUser,
|
||||
type UserWithRelations,
|
||||
createNewLocalUser,
|
||||
} from "~database/entities/User";
|
||||
import type { APIEmoji } from "~types/entities/emoji";
|
||||
import type { APIInstance } from "~types/entities/instance";
|
||||
|
|
@ -17,142 +17,142 @@ let token: Token;
|
|||
let user: UserWithRelations;
|
||||
|
||||
describe("API Tests", () => {
|
||||
beforeAll(async () => {
|
||||
// Initialize test user
|
||||
user = await createNewLocalUser({
|
||||
email: "test@test.com",
|
||||
username: "test",
|
||||
password: "test",
|
||||
display_name: "",
|
||||
});
|
||||
beforeAll(async () => {
|
||||
// Initialize test user
|
||||
user = await createNewLocalUser({
|
||||
email: "test@test.com",
|
||||
username: "test",
|
||||
password: "test",
|
||||
display_name: "",
|
||||
});
|
||||
|
||||
token = await client.token.create({
|
||||
data: {
|
||||
access_token: "test",
|
||||
application: {
|
||||
create: {
|
||||
client_id: "test",
|
||||
name: "Test Application",
|
||||
redirect_uris: "https://example.com",
|
||||
scopes: "read write",
|
||||
secret: "test",
|
||||
website: "https://example.com",
|
||||
vapid_key: null,
|
||||
},
|
||||
},
|
||||
code: "test",
|
||||
scope: "read write",
|
||||
token_type: TokenType.BEARER,
|
||||
user: {
|
||||
connect: {
|
||||
id: user.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
token = await client.token.create({
|
||||
data: {
|
||||
access_token: "test",
|
||||
application: {
|
||||
create: {
|
||||
client_id: "test",
|
||||
name: "Test Application",
|
||||
redirect_uris: "https://example.com",
|
||||
scopes: "read write",
|
||||
secret: "test",
|
||||
website: "https://example.com",
|
||||
vapid_key: null,
|
||||
},
|
||||
},
|
||||
code: "test",
|
||||
scope: "read write",
|
||||
token_type: TokenType.BEARER,
|
||||
user: {
|
||||
connect: {
|
||||
id: user.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await client.user.deleteMany({
|
||||
where: {
|
||||
username: {
|
||||
in: ["test", "test2"],
|
||||
},
|
||||
},
|
||||
});
|
||||
afterAll(async () => {
|
||||
await client.user.deleteMany({
|
||||
where: {
|
||||
username: {
|
||||
in: ["test", "test2"],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await client.application.deleteMany({
|
||||
where: {
|
||||
client_id: "test",
|
||||
},
|
||||
});
|
||||
});
|
||||
await client.application.deleteMany({
|
||||
where: {
|
||||
client_id: "test",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
describe("GET /api/v1/instance", () => {
|
||||
test("should return an APIInstance object", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(`${base_url}/api/v1/instance`, base_url),
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
)
|
||||
);
|
||||
describe("GET /api/v1/instance", () => {
|
||||
test("should return an APIInstance object", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(`${base_url}/api/v1/instance`, base_url),
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json"
|
||||
);
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
const instance = (await response.json()) as APIInstance;
|
||||
const instance = (await response.json()) as APIInstance;
|
||||
|
||||
expect(instance.uri).toBe(new URL(config.http.base_url).hostname);
|
||||
expect(instance.title).toBeDefined();
|
||||
expect(instance.description).toBeDefined();
|
||||
expect(instance.email).toBeDefined();
|
||||
expect(instance.version).toBeDefined();
|
||||
expect(instance.urls).toBeDefined();
|
||||
expect(instance.stats).toBeDefined();
|
||||
expect(instance.thumbnail).toBeDefined();
|
||||
expect(instance.languages).toBeDefined();
|
||||
// Not implemented yet
|
||||
// expect(instance.contact_account).toBeDefined();
|
||||
expect(instance.rules).toBeDefined();
|
||||
expect(instance.approval_required).toBeDefined();
|
||||
expect(instance.max_toot_chars).toBeDefined();
|
||||
});
|
||||
});
|
||||
expect(instance.uri).toBe(new URL(config.http.base_url).hostname);
|
||||
expect(instance.title).toBeDefined();
|
||||
expect(instance.description).toBeDefined();
|
||||
expect(instance.email).toBeDefined();
|
||||
expect(instance.version).toBeDefined();
|
||||
expect(instance.urls).toBeDefined();
|
||||
expect(instance.stats).toBeDefined();
|
||||
expect(instance.thumbnail).toBeDefined();
|
||||
expect(instance.languages).toBeDefined();
|
||||
// Not implemented yet
|
||||
// expect(instance.contact_account).toBeDefined();
|
||||
expect(instance.rules).toBeDefined();
|
||||
expect(instance.approval_required).toBeDefined();
|
||||
expect(instance.max_toot_chars).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("GET /api/v1/custom_emojis", () => {
|
||||
beforeAll(async () => {
|
||||
await client.emoji.create({
|
||||
data: {
|
||||
instanceId: null,
|
||||
url: "https://example.com/test.png",
|
||||
content_type: "image/png",
|
||||
shortcode: "test",
|
||||
visible_in_picker: true,
|
||||
},
|
||||
});
|
||||
});
|
||||
describe("GET /api/v1/custom_emojis", () => {
|
||||
beforeAll(async () => {
|
||||
await client.emoji.create({
|
||||
data: {
|
||||
instanceId: null,
|
||||
url: "https://example.com/test.png",
|
||||
content_type: "image/png",
|
||||
shortcode: "test",
|
||||
visible_in_picker: true,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test("should return an array of at least one custom emoji", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/custom_emojis`,
|
||||
base_url
|
||||
),
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
},
|
||||
}
|
||||
)
|
||||
);
|
||||
test("should return an array of at least one custom emoji", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/custom_emojis`,
|
||||
base_url,
|
||||
),
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json"
|
||||
);
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
const emojis = (await response.json()) as APIEmoji[];
|
||||
const emojis = (await response.json()) as APIEmoji[];
|
||||
|
||||
expect(emojis.length).toBeGreaterThan(0);
|
||||
expect(emojis[0].shortcode).toBeString();
|
||||
expect(emojis[0].url).toBeString();
|
||||
});
|
||||
expect(emojis.length).toBeGreaterThan(0);
|
||||
expect(emojis[0].shortcode).toBeString();
|
||||
expect(emojis[0].url).toBeString();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await client.emoji.deleteMany({
|
||||
where: {
|
||||
shortcode: "test",
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
afterAll(async () => {
|
||||
await client.emoji.deleteMany({
|
||||
where: {
|
||||
shortcode: "test",
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,17 +1,17 @@
|
|||
import type { Token } from "@prisma/client";
|
||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Token } from "@prisma/client";
|
||||
import { config } from "config-manager";
|
||||
import { client } from "~database/datasource";
|
||||
import { TokenType } from "~database/entities/Token";
|
||||
import {
|
||||
type UserWithRelations,
|
||||
createNewLocalUser,
|
||||
type UserWithRelations,
|
||||
createNewLocalUser,
|
||||
} from "~database/entities/User";
|
||||
import { sendTestRequest, wrapRelativeUrl } from "~tests/utils";
|
||||
import type { APIAccount } from "~types/entities/account";
|
||||
import type { APIAsyncAttachment } from "~types/entities/async_attachment";
|
||||
import type { APIContext } from "~types/entities/context";
|
||||
import type { APIStatus } from "~types/entities/status";
|
||||
import { config } from "config-manager";
|
||||
import { sendTestRequest, wrapRelativeUrl } from "~tests/utils";
|
||||
|
||||
const base_url = config.http.base_url;
|
||||
|
||||
|
|
@ -22,504 +22,504 @@ let status2: APIStatus | null = null;
|
|||
let media1: APIAsyncAttachment | null = null;
|
||||
|
||||
describe("API Tests", () => {
|
||||
beforeAll(async () => {
|
||||
await client.user.deleteMany({
|
||||
where: {
|
||||
username: {
|
||||
in: ["test", "test2"],
|
||||
},
|
||||
},
|
||||
});
|
||||
beforeAll(async () => {
|
||||
await client.user.deleteMany({
|
||||
where: {
|
||||
username: {
|
||||
in: ["test", "test2"],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
user = await createNewLocalUser({
|
||||
email: "test@test.com",
|
||||
username: "test",
|
||||
password: "test",
|
||||
display_name: "",
|
||||
});
|
||||
user = await createNewLocalUser({
|
||||
email: "test@test.com",
|
||||
username: "test",
|
||||
password: "test",
|
||||
display_name: "",
|
||||
});
|
||||
|
||||
token = await client.token.create({
|
||||
data: {
|
||||
access_token: "test",
|
||||
application: {
|
||||
create: {
|
||||
client_id: "test",
|
||||
name: "Test Application",
|
||||
redirect_uris: "https://example.com",
|
||||
scopes: "read write",
|
||||
secret: "test",
|
||||
website: "https://example.com",
|
||||
vapid_key: null,
|
||||
},
|
||||
},
|
||||
code: "test",
|
||||
scope: "read write",
|
||||
token_type: TokenType.BEARER,
|
||||
user: {
|
||||
connect: {
|
||||
id: user.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
token = await client.token.create({
|
||||
data: {
|
||||
access_token: "test",
|
||||
application: {
|
||||
create: {
|
||||
client_id: "test",
|
||||
name: "Test Application",
|
||||
redirect_uris: "https://example.com",
|
||||
scopes: "read write",
|
||||
secret: "test",
|
||||
website: "https://example.com",
|
||||
vapid_key: null,
|
||||
},
|
||||
},
|
||||
code: "test",
|
||||
scope: "read write",
|
||||
token_type: TokenType.BEARER,
|
||||
user: {
|
||||
connect: {
|
||||
id: user.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await client.user.deleteMany({
|
||||
where: {
|
||||
username: {
|
||||
in: ["test", "test2"],
|
||||
},
|
||||
},
|
||||
});
|
||||
afterAll(async () => {
|
||||
await client.user.deleteMany({
|
||||
where: {
|
||||
username: {
|
||||
in: ["test", "test2"],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await client.application.deleteMany({
|
||||
where: {
|
||||
client_id: "test",
|
||||
},
|
||||
});
|
||||
});
|
||||
await client.application.deleteMany({
|
||||
where: {
|
||||
client_id: "test",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
describe("POST /api/v2/media", () => {
|
||||
test("should upload a file and return a MediaAttachment object", async () => {
|
||||
const formData = new FormData();
|
||||
formData.append("file", new Blob(["test"], { type: "text/plain" }));
|
||||
describe("POST /api/v2/media", () => {
|
||||
test("should upload a file and return a MediaAttachment object", async () => {
|
||||
const formData = new FormData();
|
||||
formData.append("file", new Blob(["test"], { type: "text/plain" }));
|
||||
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(`${base_url}/api/v2/media`, base_url),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
},
|
||||
body: formData,
|
||||
}
|
||||
)
|
||||
);
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(`${base_url}/api/v2/media`, base_url),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
},
|
||||
body: formData,
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(202);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json"
|
||||
);
|
||||
expect(response.status).toBe(202);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
media1 = (await response.json()) as APIAsyncAttachment;
|
||||
media1 = (await response.json()) as APIAsyncAttachment;
|
||||
|
||||
expect(media1.id).toBeDefined();
|
||||
expect(media1.type).toBe("unknown");
|
||||
expect(media1.url).toBeDefined();
|
||||
});
|
||||
});
|
||||
expect(media1.id).toBeDefined();
|
||||
expect(media1.type).toBe("unknown");
|
||||
expect(media1.url).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("POST /api/v1/statuses", () => {
|
||||
test("should create a new status and return an APIStatus object", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(`${base_url}/api/v1/statuses`, base_url),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
status: "Hello, world!",
|
||||
visibility: "public",
|
||||
media_ids: [media1?.id],
|
||||
}),
|
||||
}
|
||||
)
|
||||
);
|
||||
describe("POST /api/v1/statuses", () => {
|
||||
test("should create a new status and return an APIStatus object", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(`${base_url}/api/v1/statuses`, base_url),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
status: "Hello, world!",
|
||||
visibility: "public",
|
||||
media_ids: [media1?.id],
|
||||
}),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json"
|
||||
);
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||
status = (await response.json()) as APIStatus;
|
||||
expect(status.content).toContain("Hello, world!");
|
||||
expect(status.visibility).toBe("public");
|
||||
expect(status.account.id).toBe(user.id);
|
||||
expect(status.replies_count).toBe(0);
|
||||
expect(status.favourites_count).toBe(0);
|
||||
expect(status.reblogged).toBe(false);
|
||||
expect(status.favourited).toBe(false);
|
||||
expect(status.media_attachments).toBeArrayOfSize(1);
|
||||
expect(status.mentions).toEqual([]);
|
||||
expect(status.tags).toEqual([]);
|
||||
expect(status.sensitive).toBe(false);
|
||||
expect(status.spoiler_text).toBe("");
|
||||
expect(status.language).toBeNull();
|
||||
expect(status.pinned).toBe(false);
|
||||
expect(status.visibility).toBe("public");
|
||||
expect(status.card).toBeNull();
|
||||
expect(status.poll).toBeNull();
|
||||
expect(status.emojis).toEqual([]);
|
||||
expect(status.in_reply_to_id).toBeNull();
|
||||
expect(status.in_reply_to_account_id).toBeNull();
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||
status = (await response.json()) as APIStatus;
|
||||
expect(status.content).toContain("Hello, world!");
|
||||
expect(status.visibility).toBe("public");
|
||||
expect(status.account.id).toBe(user.id);
|
||||
expect(status.replies_count).toBe(0);
|
||||
expect(status.favourites_count).toBe(0);
|
||||
expect(status.reblogged).toBe(false);
|
||||
expect(status.favourited).toBe(false);
|
||||
expect(status.media_attachments).toBeArrayOfSize(1);
|
||||
expect(status.mentions).toEqual([]);
|
||||
expect(status.tags).toEqual([]);
|
||||
expect(status.sensitive).toBe(false);
|
||||
expect(status.spoiler_text).toBe("");
|
||||
expect(status.language).toBeNull();
|
||||
expect(status.pinned).toBe(false);
|
||||
expect(status.visibility).toBe("public");
|
||||
expect(status.card).toBeNull();
|
||||
expect(status.poll).toBeNull();
|
||||
expect(status.emojis).toEqual([]);
|
||||
expect(status.in_reply_to_id).toBeNull();
|
||||
expect(status.in_reply_to_account_id).toBeNull();
|
||||
});
|
||||
|
||||
test("should create a new status in reply to the previous one", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(`${base_url}/api/v1/statuses`, base_url),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
status: "This is a reply!",
|
||||
visibility: "public",
|
||||
in_reply_to_id: status?.id,
|
||||
}),
|
||||
}
|
||||
)
|
||||
);
|
||||
test("should create a new status in reply to the previous one", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(`${base_url}/api/v1/statuses`, base_url),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
status: "This is a reply!",
|
||||
visibility: "public",
|
||||
in_reply_to_id: status?.id,
|
||||
}),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json"
|
||||
);
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||
status2 = (await response.json()) as APIStatus;
|
||||
expect(status2.content).toContain("This is a reply!");
|
||||
expect(status2.visibility).toBe("public");
|
||||
expect(status2.account.id).toBe(user.id);
|
||||
expect(status2.replies_count).toBe(0);
|
||||
expect(status2.favourites_count).toBe(0);
|
||||
expect(status2.reblogged).toBe(false);
|
||||
expect(status2.favourited).toBe(false);
|
||||
expect(status2.media_attachments).toEqual([]);
|
||||
expect(status2.mentions).toEqual([]);
|
||||
expect(status2.tags).toEqual([]);
|
||||
expect(status2.sensitive).toBe(false);
|
||||
expect(status2.spoiler_text).toBe("");
|
||||
expect(status2.language).toBeNull();
|
||||
expect(status2.pinned).toBe(false);
|
||||
expect(status2.visibility).toBe("public");
|
||||
expect(status2.card).toBeNull();
|
||||
expect(status2.poll).toBeNull();
|
||||
expect(status2.emojis).toEqual([]);
|
||||
expect(status2.in_reply_to_id).toEqual(status?.id || null);
|
||||
expect(status2.in_reply_to_account_id).toEqual(user.id);
|
||||
});
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||
status2 = (await response.json()) as APIStatus;
|
||||
expect(status2.content).toContain("This is a reply!");
|
||||
expect(status2.visibility).toBe("public");
|
||||
expect(status2.account.id).toBe(user.id);
|
||||
expect(status2.replies_count).toBe(0);
|
||||
expect(status2.favourites_count).toBe(0);
|
||||
expect(status2.reblogged).toBe(false);
|
||||
expect(status2.favourited).toBe(false);
|
||||
expect(status2.media_attachments).toEqual([]);
|
||||
expect(status2.mentions).toEqual([]);
|
||||
expect(status2.tags).toEqual([]);
|
||||
expect(status2.sensitive).toBe(false);
|
||||
expect(status2.spoiler_text).toBe("");
|
||||
expect(status2.language).toBeNull();
|
||||
expect(status2.pinned).toBe(false);
|
||||
expect(status2.visibility).toBe("public");
|
||||
expect(status2.card).toBeNull();
|
||||
expect(status2.poll).toBeNull();
|
||||
expect(status2.emojis).toEqual([]);
|
||||
expect(status2.in_reply_to_id).toEqual(status?.id || null);
|
||||
expect(status2.in_reply_to_account_id).toEqual(user.id);
|
||||
});
|
||||
});
|
||||
|
||||
describe("GET /api/v1/statuses/:id", () => {
|
||||
test("should return the specified status object", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/statuses/${status?.id}`,
|
||||
base_url
|
||||
),
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
)
|
||||
);
|
||||
describe("GET /api/v1/statuses/:id", () => {
|
||||
test("should return the specified status object", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/statuses/${status?.id}`,
|
||||
base_url,
|
||||
),
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json"
|
||||
);
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
const statusJson = (await response.json()) as APIStatus;
|
||||
const statusJson = (await response.json()) as APIStatus;
|
||||
|
||||
expect(statusJson.id).toBe(status?.id || "");
|
||||
expect(statusJson.content).toBeDefined();
|
||||
expect(statusJson.created_at).toBeDefined();
|
||||
expect(statusJson.account).toBeDefined();
|
||||
expect(statusJson.reblog).toBeDefined();
|
||||
expect(statusJson.application).toBeDefined();
|
||||
expect(statusJson.emojis).toBeDefined();
|
||||
expect(statusJson.media_attachments).toBeDefined();
|
||||
expect(statusJson.poll).toBeDefined();
|
||||
expect(statusJson.card).toBeDefined();
|
||||
expect(statusJson.visibility).toBeDefined();
|
||||
expect(statusJson.sensitive).toBeDefined();
|
||||
expect(statusJson.spoiler_text).toBeDefined();
|
||||
expect(statusJson.uri).toBeDefined();
|
||||
expect(statusJson.url).toBeDefined();
|
||||
expect(statusJson.replies_count).toBeDefined();
|
||||
expect(statusJson.reblogs_count).toBeDefined();
|
||||
expect(statusJson.favourites_count).toBeDefined();
|
||||
expect(statusJson.favourited).toBeDefined();
|
||||
expect(statusJson.reblogged).toBeDefined();
|
||||
expect(statusJson.muted).toBeDefined();
|
||||
expect(statusJson.bookmarked).toBeDefined();
|
||||
expect(statusJson.pinned).toBeDefined();
|
||||
});
|
||||
});
|
||||
expect(statusJson.id).toBe(status?.id || "");
|
||||
expect(statusJson.content).toBeDefined();
|
||||
expect(statusJson.created_at).toBeDefined();
|
||||
expect(statusJson.account).toBeDefined();
|
||||
expect(statusJson.reblog).toBeDefined();
|
||||
expect(statusJson.application).toBeDefined();
|
||||
expect(statusJson.emojis).toBeDefined();
|
||||
expect(statusJson.media_attachments).toBeDefined();
|
||||
expect(statusJson.poll).toBeDefined();
|
||||
expect(statusJson.card).toBeDefined();
|
||||
expect(statusJson.visibility).toBeDefined();
|
||||
expect(statusJson.sensitive).toBeDefined();
|
||||
expect(statusJson.spoiler_text).toBeDefined();
|
||||
expect(statusJson.uri).toBeDefined();
|
||||
expect(statusJson.url).toBeDefined();
|
||||
expect(statusJson.replies_count).toBeDefined();
|
||||
expect(statusJson.reblogs_count).toBeDefined();
|
||||
expect(statusJson.favourites_count).toBeDefined();
|
||||
expect(statusJson.favourited).toBeDefined();
|
||||
expect(statusJson.reblogged).toBeDefined();
|
||||
expect(statusJson.muted).toBeDefined();
|
||||
expect(statusJson.bookmarked).toBeDefined();
|
||||
expect(statusJson.pinned).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("POST /api/v1/statuses/:id/reblog", () => {
|
||||
test("should reblog the specified status and return the reblogged status object", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/statuses/${status?.id}/reblog`,
|
||||
base_url
|
||||
),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
)
|
||||
);
|
||||
describe("POST /api/v1/statuses/:id/reblog", () => {
|
||||
test("should reblog the specified status and return the reblogged status object", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/statuses/${status?.id}/reblog`,
|
||||
base_url,
|
||||
),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json"
|
||||
);
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
const rebloggedStatus = (await response.json()) as APIStatus;
|
||||
const rebloggedStatus = (await response.json()) as APIStatus;
|
||||
|
||||
expect(rebloggedStatus.id).toBeDefined();
|
||||
expect(rebloggedStatus.reblog?.id).toEqual(status?.id ?? "");
|
||||
expect(rebloggedStatus.reblog?.reblogged).toBe(true);
|
||||
});
|
||||
});
|
||||
expect(rebloggedStatus.id).toBeDefined();
|
||||
expect(rebloggedStatus.reblog?.id).toEqual(status?.id ?? "");
|
||||
expect(rebloggedStatus.reblog?.reblogged).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("POST /api/v1/statuses/:id/unreblog", () => {
|
||||
test("should unreblog the specified status and return the original status object", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/statuses/${status?.id}/unreblog`,
|
||||
base_url
|
||||
),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
)
|
||||
);
|
||||
describe("POST /api/v1/statuses/:id/unreblog", () => {
|
||||
test("should unreblog the specified status and return the original status object", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/statuses/${status?.id}/unreblog`,
|
||||
base_url,
|
||||
),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json"
|
||||
);
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
const unrebloggedStatus = (await response.json()) as APIStatus;
|
||||
const unrebloggedStatus = (await response.json()) as APIStatus;
|
||||
|
||||
expect(unrebloggedStatus.id).toBeDefined();
|
||||
expect(unrebloggedStatus.reblogged).toBe(false);
|
||||
});
|
||||
});
|
||||
expect(unrebloggedStatus.id).toBeDefined();
|
||||
expect(unrebloggedStatus.reblogged).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("GET /api/v1/statuses/:id/context", () => {
|
||||
test("should return the context of the specified status", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/statuses/${status?.id}/context`,
|
||||
base_url
|
||||
),
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
)
|
||||
);
|
||||
describe("GET /api/v1/statuses/:id/context", () => {
|
||||
test("should return the context of the specified status", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/statuses/${status?.id}/context`,
|
||||
base_url,
|
||||
),
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json"
|
||||
);
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
const context = (await response.json()) as APIContext;
|
||||
const context = (await response.json()) as APIContext;
|
||||
|
||||
expect(context.ancestors.length).toBe(0);
|
||||
expect(context.descendants.length).toBe(1);
|
||||
expect(context.ancestors.length).toBe(0);
|
||||
expect(context.descendants.length).toBe(1);
|
||||
|
||||
// First descendant should be status2
|
||||
expect(context.descendants[0].id).toBe(status2?.id || "");
|
||||
});
|
||||
});
|
||||
// First descendant should be status2
|
||||
expect(context.descendants[0].id).toBe(status2?.id || "");
|
||||
});
|
||||
});
|
||||
|
||||
describe("GET /api/v1/timelines/public", () => {
|
||||
test("should return an array of APIStatus objects that includes the created status", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/timelines/public`,
|
||||
base_url
|
||||
),
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
)
|
||||
);
|
||||
describe("GET /api/v1/timelines/public", () => {
|
||||
test("should return an array of APIStatus objects that includes the created status", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/timelines/public`,
|
||||
base_url,
|
||||
),
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json"
|
||||
);
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
const statuses = (await response.json()) as APIStatus[];
|
||||
const statuses = (await response.json()) as APIStatus[];
|
||||
|
||||
expect(statuses.some(s => s.id === status?.id)).toBe(true);
|
||||
});
|
||||
});
|
||||
expect(statuses.some((s) => s.id === status?.id)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("GET /api/v1/accounts/:id/statuses", () => {
|
||||
test("should return the statuses of the specified user", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/accounts/${user.id}/statuses`,
|
||||
base_url
|
||||
),
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
)
|
||||
);
|
||||
describe("GET /api/v1/accounts/:id/statuses", () => {
|
||||
test("should return the statuses of the specified user", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/accounts/${user.id}/statuses`,
|
||||
base_url,
|
||||
),
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json"
|
||||
);
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
const statuses = (await response.json()) as APIStatus[];
|
||||
const statuses = (await response.json()) as APIStatus[];
|
||||
|
||||
expect(statuses.length).toBe(2);
|
||||
expect(statuses.length).toBe(2);
|
||||
|
||||
const status1 = statuses[0];
|
||||
const status1 = statuses[0];
|
||||
|
||||
// Basic validation
|
||||
expect(status1.content).toContain("This is a reply!");
|
||||
expect(status1.visibility).toBe("public");
|
||||
expect(status1.account.id).toBe(user.id);
|
||||
});
|
||||
});
|
||||
// Basic validation
|
||||
expect(status1.content).toContain("This is a reply!");
|
||||
expect(status1.visibility).toBe("public");
|
||||
expect(status1.account.id).toBe(user.id);
|
||||
});
|
||||
});
|
||||
|
||||
describe("POST /api/v1/statuses/:id/favourite", () => {
|
||||
test("should favourite the specified status object", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/statuses/${status?.id}/favourite`,
|
||||
base_url
|
||||
),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
)
|
||||
);
|
||||
describe("POST /api/v1/statuses/:id/favourite", () => {
|
||||
test("should favourite the specified status object", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/statuses/${status?.id}/favourite`,
|
||||
base_url,
|
||||
),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
});
|
||||
});
|
||||
expect(response.status).toBe(200);
|
||||
});
|
||||
});
|
||||
|
||||
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.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
)
|
||||
);
|
||||
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.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json"
|
||||
);
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
const users = (await response.json()) as APIAccount[];
|
||||
const users = (await response.json()) as APIAccount[];
|
||||
|
||||
expect(users.length).toBe(1);
|
||||
expect(users[0].id).toBe(user.id);
|
||||
});
|
||||
});
|
||||
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
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/statuses/${status?.id}/unfavourite`,
|
||||
base_url
|
||||
),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
)
|
||||
);
|
||||
describe("POST /api/v1/statuses/:id/unfavourite", () => {
|
||||
test("should unfavourite the specified status object", async () => {
|
||||
// Unfavourite the status
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/statuses/${status?.id}/unfavourite`,
|
||||
base_url,
|
||||
),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json"
|
||||
);
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
const updatedStatus = (await response.json()) as APIStatus;
|
||||
const updatedStatus = (await response.json()) as APIStatus;
|
||||
|
||||
expect(updatedStatus.favourited).toBe(false);
|
||||
expect(updatedStatus.favourites_count).toBe(0);
|
||||
});
|
||||
});
|
||||
expect(updatedStatus.favourited).toBe(false);
|
||||
expect(updatedStatus.favourites_count).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("DELETE /api/v1/statuses/:id", () => {
|
||||
test("should delete the specified status object", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/statuses/${status?.id}`,
|
||||
base_url
|
||||
),
|
||||
{
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
},
|
||||
}
|
||||
)
|
||||
);
|
||||
describe("DELETE /api/v1/statuses/:id", () => {
|
||||
test("should delete the specified status object", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`${base_url}/api/v1/statuses/${status?.id}`,
|
||||
base_url,
|
||||
),
|
||||
{
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
});
|
||||
});
|
||||
expect(response.status).toBe(200);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,92 +3,92 @@ import { client } from "~database/datasource";
|
|||
import { createNewLocalUser } from "~database/entities/User";
|
||||
|
||||
describe("cli.ts", () => {
|
||||
describe("User creation", () => {
|
||||
it("should execute user create command without admin flag", async () => {
|
||||
afterAll(async () => {
|
||||
await client.user.deleteMany({
|
||||
where: {
|
||||
username: "testuser297",
|
||||
email: "testuser297@gmail.com",
|
||||
},
|
||||
});
|
||||
});
|
||||
describe("User creation", () => {
|
||||
it("should execute user create command without admin flag", async () => {
|
||||
afterAll(async () => {
|
||||
await client.user.deleteMany({
|
||||
where: {
|
||||
username: "testuser297",
|
||||
email: "testuser297@gmail.com",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
// Run command and wait for it to finish
|
||||
Bun.spawnSync([
|
||||
"bun",
|
||||
"run",
|
||||
"cli.ts",
|
||||
"user",
|
||||
"create",
|
||||
"testuser297",
|
||||
"password123",
|
||||
"testuser297@gmail.com",
|
||||
]);
|
||||
// Run command and wait for it to finish
|
||||
Bun.spawnSync([
|
||||
"bun",
|
||||
"run",
|
||||
"cli.ts",
|
||||
"user",
|
||||
"create",
|
||||
"testuser297",
|
||||
"password123",
|
||||
"testuser297@gmail.com",
|
||||
]);
|
||||
|
||||
const createdUser = await client.user.findFirst({
|
||||
where: {
|
||||
username: "testuser297",
|
||||
email: "testuser297@gmail.com",
|
||||
},
|
||||
});
|
||||
const createdUser = await client.user.findFirst({
|
||||
where: {
|
||||
username: "testuser297",
|
||||
email: "testuser297@gmail.com",
|
||||
},
|
||||
});
|
||||
|
||||
expect(createdUser).toBeDefined();
|
||||
});
|
||||
expect(createdUser).toBeDefined();
|
||||
});
|
||||
|
||||
it("should execute user create command with admin flag", async () => {
|
||||
afterAll(async () => {
|
||||
await client.user.deleteMany({
|
||||
where: {
|
||||
username: "testuser297",
|
||||
email: "testuser297@gmail.com",
|
||||
},
|
||||
});
|
||||
});
|
||||
it("should execute user create command with admin flag", async () => {
|
||||
afterAll(async () => {
|
||||
await client.user.deleteMany({
|
||||
where: {
|
||||
username: "testuser297",
|
||||
email: "testuser297@gmail.com",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
// Run command and wait for it to finish
|
||||
Bun.spawnSync([
|
||||
"bun",
|
||||
"run",
|
||||
"cli.ts",
|
||||
"user",
|
||||
"create",
|
||||
"testuser297",
|
||||
"password123",
|
||||
"testuser297@gmail.com",
|
||||
"--admin",
|
||||
]);
|
||||
// Run command and wait for it to finish
|
||||
Bun.spawnSync([
|
||||
"bun",
|
||||
"run",
|
||||
"cli.ts",
|
||||
"user",
|
||||
"create",
|
||||
"testuser297",
|
||||
"password123",
|
||||
"testuser297@gmail.com",
|
||||
"--admin",
|
||||
]);
|
||||
|
||||
const createdUser = await client.user.findFirst({
|
||||
where: {
|
||||
username: "testuser297",
|
||||
email: "testuser297@gmail.com",
|
||||
isAdmin: true,
|
||||
},
|
||||
});
|
||||
const createdUser = await client.user.findFirst({
|
||||
where: {
|
||||
username: "testuser297",
|
||||
email: "testuser297@gmail.com",
|
||||
isAdmin: true,
|
||||
},
|
||||
});
|
||||
|
||||
expect(createdUser).toBeDefined();
|
||||
});
|
||||
});
|
||||
expect(createdUser).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
it("should execute user delete command", async () => {
|
||||
beforeAll(async () => {
|
||||
await createNewLocalUser({
|
||||
username: "bob124",
|
||||
password: "jesus",
|
||||
email: "bob124@bob124.com",
|
||||
});
|
||||
});
|
||||
it("should execute user delete command", async () => {
|
||||
beforeAll(async () => {
|
||||
await createNewLocalUser({
|
||||
username: "bob124",
|
||||
password: "jesus",
|
||||
email: "bob124@bob124.com",
|
||||
});
|
||||
});
|
||||
|
||||
Bun.spawnSync(["bun", "run", "cli", "user", "delete", "bob124"]);
|
||||
Bun.spawnSync(["bun", "run", "cli", "user", "delete", "bob124"]);
|
||||
|
||||
const userExists = await client.user.findFirst({
|
||||
where: {
|
||||
username: "bob124",
|
||||
email: "bob124@bob124.com",
|
||||
},
|
||||
});
|
||||
const userExists = await client.user.findFirst({
|
||||
where: {
|
||||
username: "bob124",
|
||||
email: "bob124@bob124.com",
|
||||
},
|
||||
});
|
||||
|
||||
expect(!!userExists).toBe(false);
|
||||
});
|
||||
expect(!!userExists).toBe(false);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,95 +1,135 @@
|
|||
import { checkIfOauthIsValid } from "@oauth";
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { checkIfOauthIsValid } from "@oauth";
|
||||
import type { Application } from "@prisma/client";
|
||||
|
||||
describe("checkIfOauthIsValid", () => {
|
||||
it("should return true when routeScopes and application.scopes are empty", () => {
|
||||
const application = { scopes: "" };
|
||||
const routeScopes: string[] = [];
|
||||
const result = checkIfOauthIsValid(application as any, routeScopes);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
it("should return true when routeScopes and application.scopes are empty", () => {
|
||||
const application = { scopes: "" };
|
||||
const routeScopes: string[] = [];
|
||||
const result = checkIfOauthIsValid(
|
||||
application as Application,
|
||||
routeScopes,
|
||||
);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it("should return true when routeScopes is empty and application.scopes contains write:* or write", () => {
|
||||
const application = { scopes: "write:*" };
|
||||
const routeScopes: string[] = [];
|
||||
const result = checkIfOauthIsValid(application as any, routeScopes);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
it("should return true when routeScopes is empty and application.scopes contains write:* or write", () => {
|
||||
const application = { scopes: "write:*" };
|
||||
const routeScopes: string[] = [];
|
||||
const result = checkIfOauthIsValid(
|
||||
application as Application,
|
||||
routeScopes,
|
||||
);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it("should return true when routeScopes is empty and application.scopes contains read:* or read", () => {
|
||||
const application = { scopes: "read:*" };
|
||||
const routeScopes: string[] = [];
|
||||
const result = checkIfOauthIsValid(application as any, routeScopes);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
it("should return true when routeScopes is empty and application.scopes contains read:* or read", () => {
|
||||
const application = { scopes: "read:*" };
|
||||
const routeScopes: string[] = [];
|
||||
const result = checkIfOauthIsValid(
|
||||
application as Application,
|
||||
routeScopes,
|
||||
);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it("should return true when routeScopes contains only write: permissions and application.scopes contains write:* or write", () => {
|
||||
const application = { scopes: "write:*" };
|
||||
const routeScopes = ["write:users", "write:posts"];
|
||||
const result = checkIfOauthIsValid(application as any, routeScopes);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
it("should return true when routeScopes contains only write: permissions and application.scopes contains write:* or write", () => {
|
||||
const application = { scopes: "write:*" };
|
||||
const routeScopes = ["write:users", "write:posts"];
|
||||
const result = checkIfOauthIsValid(
|
||||
application as Application,
|
||||
routeScopes,
|
||||
);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it("should return true when routeScopes contains only read: permissions and application.scopes contains read:* or read", () => {
|
||||
const application = { scopes: "read:*" };
|
||||
const routeScopes = ["read:users", "read:posts"];
|
||||
const result = checkIfOauthIsValid(application as any, routeScopes);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
it("should return true when routeScopes contains only read: permissions and application.scopes contains read:* or read", () => {
|
||||
const application = { scopes: "read:*" };
|
||||
const routeScopes = ["read:users", "read:posts"];
|
||||
const result = checkIfOauthIsValid(
|
||||
application as Application,
|
||||
routeScopes,
|
||||
);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it("should return true when routeScopes contains both write: and read: permissions and application.scopes contains write:* or write and read:* or read", () => {
|
||||
const application = { scopes: "write:* read:*" };
|
||||
const routeScopes = ["write:users", "read:posts"];
|
||||
const result = checkIfOauthIsValid(application as any, routeScopes);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
it("should return true when routeScopes contains both write: and read: permissions and application.scopes contains write:* or write and read:* or read", () => {
|
||||
const application = { scopes: "write:* read:*" };
|
||||
const routeScopes = ["write:users", "read:posts"];
|
||||
const result = checkIfOauthIsValid(
|
||||
application as Application,
|
||||
routeScopes,
|
||||
);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it("should return false when routeScopes contains write: permissions but application.scopes does not contain write:* or write", () => {
|
||||
const application = { scopes: "read:*" };
|
||||
const routeScopes = ["write:users", "write:posts"];
|
||||
const result = checkIfOauthIsValid(application as any, routeScopes);
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
it("should return false when routeScopes contains write: permissions but application.scopes does not contain write:* or write", () => {
|
||||
const application = { scopes: "read:*" };
|
||||
const routeScopes = ["write:users", "write:posts"];
|
||||
const result = checkIfOauthIsValid(
|
||||
application as Application,
|
||||
routeScopes,
|
||||
);
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
|
||||
it("should return false when routeScopes contains read: permissions but application.scopes does not contain read:* or read", () => {
|
||||
const application = { scopes: "write:*" };
|
||||
const routeScopes = ["read:users", "read:posts"];
|
||||
const result = checkIfOauthIsValid(application as any, routeScopes);
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
it("should return false when routeScopes contains read: permissions but application.scopes does not contain read:* or read", () => {
|
||||
const application = { scopes: "write:*" };
|
||||
const routeScopes = ["read:users", "read:posts"];
|
||||
const result = checkIfOauthIsValid(
|
||||
application as Application,
|
||||
routeScopes,
|
||||
);
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
|
||||
it("should return false when routeScopes contains both write: and read: permissions but application.scopes does not contain write:* or write and read:* or read", () => {
|
||||
const application = { scopes: "" };
|
||||
const routeScopes = ["write:users", "read:posts"];
|
||||
const result = checkIfOauthIsValid(application as any, routeScopes);
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
it("should return false when routeScopes contains both write: and read: permissions but application.scopes does not contain write:* or write and read:* or read", () => {
|
||||
const application = { scopes: "" };
|
||||
const routeScopes = ["write:users", "read:posts"];
|
||||
const result = checkIfOauthIsValid(
|
||||
application as Application,
|
||||
routeScopes,
|
||||
);
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
|
||||
it("should return true when routeScopes contains a mix of valid and invalid permissions and application.scopes contains all the required permissions", () => {
|
||||
const application = { scopes: "write:* read:*" };
|
||||
const routeScopes = ["write:users", "invalid:permission", "read:posts"];
|
||||
const result = checkIfOauthIsValid(application as any, routeScopes);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
it("should return true when routeScopes contains a mix of valid and invalid permissions and application.scopes contains all the required permissions", () => {
|
||||
const application = { scopes: "write:* read:*" };
|
||||
const routeScopes = ["write:users", "invalid:permission", "read:posts"];
|
||||
const result = checkIfOauthIsValid(
|
||||
application as Application,
|
||||
routeScopes,
|
||||
);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it("should return false when routeScopes contains a mix of valid and invalid permissions but application.scopes does not contain all the required permissions", () => {
|
||||
const application = { scopes: "write:*" };
|
||||
const routeScopes = ["write:users", "invalid:permission", "read:posts"];
|
||||
const result = checkIfOauthIsValid(application as any, routeScopes);
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
it("should return false when routeScopes contains a mix of valid and invalid permissions but application.scopes does not contain all the required permissions", () => {
|
||||
const application = { scopes: "write:*" };
|
||||
const routeScopes = ["write:users", "invalid:permission", "read:posts"];
|
||||
const result = checkIfOauthIsValid(
|
||||
application as Application,
|
||||
routeScopes,
|
||||
);
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
|
||||
it("should return true when routeScopes contains a mix of valid write and read permissions and application.scopes contains all the required permissions", () => {
|
||||
const application = { scopes: "write:* read:posts" };
|
||||
const routeScopes = ["write:users", "read:posts"];
|
||||
const result = checkIfOauthIsValid(application as any, routeScopes);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
it("should return true when routeScopes contains a mix of valid write and read permissions and application.scopes contains all the required permissions", () => {
|
||||
const application = { scopes: "write:* read:posts" };
|
||||
const routeScopes = ["write:users", "read:posts"];
|
||||
const result = checkIfOauthIsValid(
|
||||
application as Application,
|
||||
routeScopes,
|
||||
);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it("should return false when routeScopes contains a mix of valid write and read permissions but application.scopes does not contain all the required permissions", () => {
|
||||
const application = { scopes: "write:*" };
|
||||
const routeScopes = ["write:users", "read:posts"];
|
||||
const result = checkIfOauthIsValid(application as any, routeScopes);
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
it("should return false when routeScopes contains a mix of valid write and read permissions but application.scopes does not contain all the required permissions", () => {
|
||||
const application = { scopes: "write:*" };
|
||||
const routeScopes = ["write:users", "read:posts"];
|
||||
const result = checkIfOauthIsValid(
|
||||
application as Application,
|
||||
routeScopes,
|
||||
);
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { Application, Token } from "@prisma/client";
|
||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Application, Token } from "@prisma/client";
|
||||
import { client } from "~database/datasource";
|
||||
import { createNewLocalUser } from "~database/entities/User";
|
||||
import { sendTestRequest, wrapRelativeUrl } from "./utils";
|
||||
|
|
@ -12,152 +12,152 @@ let code: string;
|
|||
let token: Token;
|
||||
|
||||
beforeAll(async () => {
|
||||
// Init test user
|
||||
await createNewLocalUser({
|
||||
email: "test@test.com",
|
||||
username: "test",
|
||||
password: "test",
|
||||
display_name: "",
|
||||
});
|
||||
// Init test user
|
||||
await createNewLocalUser({
|
||||
email: "test@test.com",
|
||||
username: "test",
|
||||
password: "test",
|
||||
display_name: "",
|
||||
});
|
||||
});
|
||||
|
||||
describe("POST /api/v1/apps/", () => {
|
||||
test("should create an application", async () => {
|
||||
const formData = new FormData();
|
||||
test("should create an application", async () => {
|
||||
const formData = new FormData();
|
||||
|
||||
formData.append("client_name", "Test Application");
|
||||
formData.append("website", "https://example.com");
|
||||
formData.append("redirect_uris", "https://example.com");
|
||||
formData.append("scopes", "read write");
|
||||
formData.append("client_name", "Test Application");
|
||||
formData.append("website", "https://example.com");
|
||||
formData.append("redirect_uris", "https://example.com");
|
||||
formData.append("scopes", "read write");
|
||||
|
||||
const response = await sendTestRequest(
|
||||
new Request(wrapRelativeUrl("/api/v1/apps/", base_url), {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
})
|
||||
);
|
||||
const response = await sendTestRequest(
|
||||
new Request(wrapRelativeUrl("/api/v1/apps/", base_url), {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
}),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe("application/json");
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe("application/json");
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const json = await response.json();
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const json = await response.json();
|
||||
|
||||
expect(json).toEqual({
|
||||
id: expect.any(String),
|
||||
name: "Test Application",
|
||||
website: "https://example.com",
|
||||
client_id: expect.any(String),
|
||||
client_secret: expect.any(String),
|
||||
redirect_uri: "https://example.com",
|
||||
vapid_link: null,
|
||||
});
|
||||
expect(json).toEqual({
|
||||
id: expect.any(String),
|
||||
name: "Test Application",
|
||||
website: "https://example.com",
|
||||
client_id: expect.any(String),
|
||||
client_secret: expect.any(String),
|
||||
redirect_uri: "https://example.com",
|
||||
vapid_link: null,
|
||||
});
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
||||
client_id = json.client_id;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
||||
client_secret = json.client_secret;
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
||||
client_id = json.client_id;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
||||
client_secret = json.client_secret;
|
||||
});
|
||||
});
|
||||
|
||||
describe("POST /auth/login/", () => {
|
||||
test("should get a code", async () => {
|
||||
const formData = new FormData();
|
||||
test("should get a code", async () => {
|
||||
const formData = new FormData();
|
||||
|
||||
formData.append("email", "test@test.com");
|
||||
formData.append("password", "test");
|
||||
formData.append("email", "test@test.com");
|
||||
formData.append("password", "test");
|
||||
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`/auth/login/?client_id=${client_id}&redirect_uri=https://example.com&response_type=code&scope=read+write`,
|
||||
base_url
|
||||
),
|
||||
{
|
||||
method: "POST",
|
||||
body: formData,
|
||||
}
|
||||
)
|
||||
);
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`/auth/login/?client_id=${client_id}&redirect_uri=https://example.com&response_type=code&scope=read+write`,
|
||||
base_url,
|
||||
),
|
||||
{
|
||||
method: "POST",
|
||||
body: formData,
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(302);
|
||||
expect(response.headers.get("Location")).toMatch(
|
||||
/^\/oauth\/redirect\?redirect_uri=https%3A%2F%2Fexample.com&code=[a-f0-9]+&client_id=[a-zA-Z0-9_-]+&application=Test\+Application&website=https%3A%2F%2Fexample.com&scope=read\+write$/
|
||||
);
|
||||
expect(response.status).toBe(302);
|
||||
expect(response.headers.get("Location")).toMatch(
|
||||
/^\/oauth\/redirect\?redirect_uri=https%3A%2F%2Fexample.com&code=[a-f0-9]+&client_id=[a-zA-Z0-9_-]+&application=Test\+Application&website=https%3A%2F%2Fexample.com&scope=read\+write$/,
|
||||
);
|
||||
|
||||
code =
|
||||
new URL(
|
||||
response.headers.get("Location") ?? "",
|
||||
"http://lysand.localhost:8080"
|
||||
).searchParams.get("code") ?? "";
|
||||
});
|
||||
code =
|
||||
new URL(
|
||||
response.headers.get("Location") ?? "",
|
||||
"http://lysand.localhost:8080",
|
||||
).searchParams.get("code") ?? "";
|
||||
});
|
||||
});
|
||||
|
||||
describe("POST /oauth/token/", () => {
|
||||
test("should get an access token", async () => {
|
||||
const formData = new FormData();
|
||||
test("should get an access token", async () => {
|
||||
const formData = new FormData();
|
||||
|
||||
formData.append("grant_type", "authorization_code");
|
||||
formData.append("code", code);
|
||||
formData.append("redirect_uri", "https://example.com");
|
||||
formData.append("client_id", client_id);
|
||||
formData.append("client_secret", client_secret);
|
||||
formData.append("scope", "read+write");
|
||||
formData.append("grant_type", "authorization_code");
|
||||
formData.append("code", code);
|
||||
formData.append("redirect_uri", "https://example.com");
|
||||
formData.append("client_id", client_id);
|
||||
formData.append("client_secret", client_secret);
|
||||
formData.append("scope", "read+write");
|
||||
|
||||
const response = await sendTestRequest(
|
||||
new Request(wrapRelativeUrl("/oauth/token/", base_url), {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
})
|
||||
);
|
||||
const response = await sendTestRequest(
|
||||
new Request(wrapRelativeUrl("/oauth/token/", base_url), {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
}),
|
||||
);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const json = await response.json();
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const json = await response.json();
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe("application/json");
|
||||
expect(json).toEqual({
|
||||
access_token: expect.any(String),
|
||||
token_type: "Bearer",
|
||||
scope: "read write",
|
||||
created_at: expect.any(String),
|
||||
});
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe("application/json");
|
||||
expect(json).toEqual({
|
||||
access_token: expect.any(String),
|
||||
token_type: "Bearer",
|
||||
scope: "read write",
|
||||
created_at: expect.any(String),
|
||||
});
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
||||
token = json;
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
||||
token = json;
|
||||
});
|
||||
});
|
||||
|
||||
describe("GET /api/v1/apps/verify_credentials", () => {
|
||||
test("should return the authenticated application's credentials", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl("/api/v1/apps/verify_credentials", base_url),
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
},
|
||||
}
|
||||
)
|
||||
);
|
||||
test("should return the authenticated application's credentials", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl("/api/v1/apps/verify_credentials", base_url),
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe("application/json");
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe("application/json");
|
||||
|
||||
const credentials = (await response.json()) as Partial<Application>;
|
||||
const credentials = (await response.json()) as Partial<Application>;
|
||||
|
||||
expect(credentials.name).toBe("Test Application");
|
||||
expect(credentials.website).toBe("https://example.com");
|
||||
expect(credentials.redirect_uris).toBe("https://example.com");
|
||||
expect(credentials.scopes).toBe("read write");
|
||||
});
|
||||
expect(credentials.name).toBe("Test Application");
|
||||
expect(credentials.website).toBe("https://example.com");
|
||||
expect(credentials.redirect_uris).toBe("https://example.com");
|
||||
expect(credentials.scopes).toBe("read write");
|
||||
});
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
// Clean up user
|
||||
await client.user.delete({
|
||||
where: {
|
||||
username: "test",
|
||||
},
|
||||
});
|
||||
// Clean up user
|
||||
await client.user.delete({
|
||||
where: {
|
||||
username: "test",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ import { server } from "~index";
|
|||
* @returns Response from the server
|
||||
*/
|
||||
export async function sendTestRequest(req: Request) {
|
||||
return server.fetch(req);
|
||||
return server.fetch(req);
|
||||
}
|
||||
|
||||
export function wrapRelativeUrl(url: string, base_url: string) {
|
||||
return new URL(url, base_url);
|
||||
return new URL(url, base_url);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue