mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
feat(api): 🎨 Allow login with either username or email
This commit is contained in:
parent
47c88dd7dd
commit
f9c9a7d527
7 changed files with 260 additions and 62 deletions
|
|
@ -1,9 +1,11 @@
|
|||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import { config } from "config-manager";
|
||||
import { getTestUsers, sendTestRequest, wrapRelativeUrl } from "~tests/utils";
|
||||
import type { Account as APIAccount } from "~types/mastodon/account";
|
||||
import type { Relationship as APIRelationship } from "~types/mastodon/relationship";
|
||||
import type { Status as APIStatus } from "~types/mastodon/status";
|
||||
|
||||
const base_url = config.http.base_url;
|
||||
|
||||
|
|
@ -105,33 +107,6 @@ describe("API Tests", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("GET /api/v1/accounts/:id/statuses", () => {
|
||||
test("should return the statuses of the specified user", async () => {
|
||||
const response = await sendTestRequest(
|
||||
new Request(
|
||||
wrapRelativeUrl(
|
||||
`/api/v1/accounts/${user.id}/statuses`,
|
||||
base_url,
|
||||
),
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.accessToken}`,
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get("content-type")).toBe(
|
||||
"application/json",
|
||||
);
|
||||
|
||||
const statuses = (await response.json()) as APIStatus[];
|
||||
|
||||
expect(statuses.length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
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(
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import { config } from "config-manager";
|
||||
import { getTestUsers, sendTestRequest, wrapRelativeUrl } from "~tests/utils";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue