mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
Tweaks to test
This commit is contained in:
parent
dbf855df18
commit
3c289dd3de
|
|
@ -4,7 +4,7 @@ import { User } from "~database/entities/User";
|
||||||
import { applyConfig } from "@api";
|
import { applyConfig } from "@api";
|
||||||
|
|
||||||
export const meta = applyConfig({
|
export const meta = applyConfig({
|
||||||
allowedMethods: ["POST"],
|
allowedMethods: ["GET"],
|
||||||
ratelimits: {
|
ratelimits: {
|
||||||
max: 30,
|
max: 30,
|
||||||
duration: 60,
|
duration: 60,
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,9 @@ describe("GET /api/v1/accounts/verify_credentials", () => {
|
||||||
expect(account.following_count).toBe(0);
|
expect(account.following_count).toBe(0);
|
||||||
expect(account.statuses_count).toBe(0);
|
expect(account.statuses_count).toBe(0);
|
||||||
expect(account.note).toBe("");
|
expect(account.note).toBe("");
|
||||||
expect(account.url).toBe(`${config.http.base_url}/users/${user.username}`);
|
expect(account.url).toBe(
|
||||||
|
`${config.http.base_url}/users/${user.username}`
|
||||||
|
);
|
||||||
expect(account.avatar).toBeDefined();
|
expect(account.avatar).toBeDefined();
|
||||||
expect(account.avatar_static).toBeDefined();
|
expect(account.avatar_static).toBeDefined();
|
||||||
expect(account.header).toBeDefined();
|
expect(account.header).toBeDefined();
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,13 @@ describe("POST /@test/inbox", () => {
|
||||||
test("should store a new Note object", async () => {
|
test("should store a new Note object", async () => {
|
||||||
const activityId = `https://example.com/objects/${crypto.randomUUID()}`;
|
const activityId = `https://example.com/objects/${crypto.randomUUID()}`;
|
||||||
|
|
||||||
const response = await fetch(`${config.http.base_url}/users/test/inbox/`, {
|
const response = await fetch(
|
||||||
|
`${config.http.base_url}/users/test/inbox/`,
|
||||||
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/activity+json",
|
"Content-Type": "application/activity+json",
|
||||||
|
Origin: "http://lysand-test.localhost",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
|
|
@ -50,7 +53,8 @@ describe("POST /@test/inbox", () => {
|
||||||
published: "2021-01-01T00:00:00.000Z",
|
published: "2021-01-01T00:00:00.000Z",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
expect(response.status).toBe(200);
|
expect(response.status).toBe(200);
|
||||||
expect(response.headers.get("content-type")).toBe("application/json");
|
expect(response.headers.get("content-type")).toBe("application/json");
|
||||||
|
|
@ -82,10 +86,13 @@ describe("POST /@test/inbox", () => {
|
||||||
test("should try to update that Note object", async () => {
|
test("should try to update that Note object", async () => {
|
||||||
const activityId = `https://example.com/objects/${crypto.randomUUID()}`;
|
const activityId = `https://example.com/objects/${crypto.randomUUID()}`;
|
||||||
|
|
||||||
const response = await fetch(`${config.http.base_url}/users/test/inbox/`, {
|
const response = await fetch(
|
||||||
|
`${config.http.base_url}/users/test/inbox/`,
|
||||||
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/activity+json",
|
"Content-Type": "application/activity+json",
|
||||||
|
Origin: "http://lysand-test.localhost",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
|
|
@ -109,7 +116,8 @@ describe("POST /@test/inbox", () => {
|
||||||
published: "2021-01-01T00:00:00.000Z",
|
published: "2021-01-01T00:00:00.000Z",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
expect(response.status).toBe(200);
|
expect(response.status).toBe(200);
|
||||||
expect(response.headers.get("content-type")).toBe("application/json");
|
expect(response.headers.get("content-type")).toBe("application/json");
|
||||||
|
|
@ -140,10 +148,13 @@ describe("POST /@test/inbox", () => {
|
||||||
|
|
||||||
test("should delete the Note object", async () => {
|
test("should delete the Note object", async () => {
|
||||||
const activityId = `https://example.com/objects/${crypto.randomUUID()}`;
|
const activityId = `https://example.com/objects/${crypto.randomUUID()}`;
|
||||||
const response = await fetch(`${config.http.base_url}/users/test/inbox/`, {
|
const response = await fetch(
|
||||||
|
`${config.http.base_url}/users/test/inbox/`,
|
||||||
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/activity+json",
|
"Content-Type": "application/activity+json",
|
||||||
|
Origin: "http://lysand-test.localhost",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
|
|
@ -167,7 +178,8 @@ describe("POST /@test/inbox", () => {
|
||||||
published: "2021-01-01T00:00:00.000Z",
|
published: "2021-01-01T00:00:00.000Z",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
expect(response.status).toBe(200);
|
expect(response.status).toBe(200);
|
||||||
expect(response.headers.get("content-type")).toBe("application/json");
|
expect(response.headers.get("content-type")).toBe("application/json");
|
||||||
|
|
@ -226,10 +238,13 @@ describe("POST /@test/inbox", () => {
|
||||||
test("should return a 404 error when trying to delete a non-existent Note object", async () => {
|
test("should return a 404 error when trying to delete a non-existent Note object", async () => {
|
||||||
const activityId = `https://example.com/objects/${crypto.randomUUID()}`;
|
const activityId = `https://example.com/objects/${crypto.randomUUID()}`;
|
||||||
|
|
||||||
const response = await fetch(`${config.http.base_url}/users/test/inbox/`, {
|
const response = await fetch(
|
||||||
|
`${config.http.base_url}/users/test/inbox/`,
|
||||||
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/activity+json",
|
"Content-Type": "application/activity+json",
|
||||||
|
Origin: "http://lysand-test.localhost",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
|
|
@ -249,7 +264,8 @@ describe("POST /@test/inbox", () => {
|
||||||
type: "Note",
|
type: "Note",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
expect(response.status).toBe(404);
|
expect(response.status).toBe(404);
|
||||||
expect(response.headers.get("content-type")).toBe("application/json");
|
expect(response.headers.get("content-type")).toBe("application/json");
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
"strictFunctionTypes": true,
|
"strictFunctionTypes": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": false,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"types": [
|
"types": [
|
||||||
"bun-types" // add Bun global
|
"bun-types" // add Bun global
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue