refactor: 🚨 Use shortand property syntax for object literals

This commit is contained in:
Jesse Wierzbinski 2024-10-03 13:41:58 +02:00
parent 48ffe97849
commit 3fade63567
No known key found for this signature in database
15 changed files with 31 additions and 31 deletions

View file

@ -24,7 +24,7 @@ describe(meta.route, () => {
"X-Challenge-Solution": await getSolvedChallenge(), "X-Challenge-Solution": await getSolvedChallenge(),
}, },
body: JSON.stringify({ body: JSON.stringify({
username: username, username,
email: "bob@gamer.com", email: "bob@gamer.com",
password: "password", password: "password",
agreement: "true", agreement: "true",
@ -44,7 +44,7 @@ describe(meta.route, () => {
"X-Challenge-Solution": await getSolvedChallenge(), "X-Challenge-Solution": await getSolvedChallenge(),
}, },
body: JSON.stringify({ body: JSON.stringify({
username: username, username,
email: "bob", email: "bob",
password: "password", password: "password",
agreement: "true", agreement: "true",
@ -64,7 +64,7 @@ describe(meta.route, () => {
"X-Challenge-Solution": await getSolvedChallenge(), "X-Challenge-Solution": await getSolvedChallenge(),
}, },
body: JSON.stringify({ body: JSON.stringify({
username: username, username,
email: "contatc@bob.com", email: "contatc@bob.com",
agreement: "true", agreement: "true",
locale: "en", locale: "en",
@ -83,7 +83,7 @@ describe(meta.route, () => {
"X-Challenge-Solution": await getSolvedChallenge(), "X-Challenge-Solution": await getSolvedChallenge(),
}, },
body: JSON.stringify({ body: JSON.stringify({
username: username, username,
email: "contact@george.com", email: "contact@george.com",
password: "password", password: "password",
agreement: "true", agreement: "true",
@ -119,7 +119,7 @@ describe(meta.route, () => {
"X-Challenge-Solution": await getSolvedChallenge(), "X-Challenge-Solution": await getSolvedChallenge(),
}, },
body: JSON.stringify({ body: JSON.stringify({
username: username, username,
email: "contact@george.com", email: "contact@george.com",
password: "password", password: "password",
agreement: "true", agreement: "true",

View file

@ -150,7 +150,7 @@ describe(meta.route, () => {
expect(response2.ok).toBe(true); expect(response2.ok).toBe(true);
const emojis = await response2.json(); const emojis = await response2.json();
expect(emojis).not.toContainEqual(expect.objectContaining({ id: id })); expect(emojis).not.toContainEqual(expect.objectContaining({ id }));
}); });
test("should delete the emoji", async () => { test("should delete the emoji", async () => {

View file

@ -250,7 +250,7 @@ export default apiRoute((app) =>
await db.insert(Tokens).values({ await db.insert(Tokens).values({
accessToken: randomString(64, "base64url"), accessToken: randomString(64, "base64url"),
code: code, code,
scope: flow.application.scopes, scope: flow.application.scopes,
tokenType: TokenType.Bearer, tokenType: TokenType.Bearer,
userId: user.id, userId: user.id,

View file

@ -277,7 +277,7 @@ export const followRequestToVersia = (
return { return {
type: "Follow", type: "Follow",
id: id, id,
author: follower.getUri(), author: follower.getUri(),
followee: followee.getUri(), followee: followee.getUri(),
created_at: new Date().toISOString(), created_at: new Date().toISOString(),
@ -304,7 +304,7 @@ export const followAcceptToVersia = (
return { return {
type: "FollowAccept", type: "FollowAccept",
id: id, id,
author: followee.getUri(), author: followee.getUri(),
created_at: new Date().toISOString(), created_at: new Date().toISOString(),
follower: follower.getUri(), follower: follower.getUri(),

View file

@ -230,7 +230,7 @@ export class Emoji extends BaseInterface<typeof Emojis, EmojiWithInstance> {
alt: Object.entries(emoji.url)[0][1].description || undefined, alt: Object.entries(emoji.url)[0][1].description || undefined,
contentType: Object.keys(emoji.url)[0], contentType: Object.keys(emoji.url)[0],
visibleInPicker: true, visibleInPicker: true,
instanceId: instanceId, instanceId,
}); });
} }
} }

View file

@ -338,7 +338,7 @@ export class Instance extends BaseInterface<typeof Instances> {
name: metadata.name, name: metadata.name,
version: metadata.software.version, version: metadata.software.version,
logo: metadata.logo, logo: metadata.logo,
protocol: protocol, protocol,
}); });
} }

View file

@ -140,7 +140,7 @@ export class OAuthManager {
await db.insert(OpenIdAccounts).values({ await db.insert(OpenIdAccounts).values({
serverId: sub, serverId: sub,
issuerId: this.issuer.id, issuerId: this.issuer.id,
userId: userId, userId,
}); });
} }
@ -273,9 +273,9 @@ export class OAuthManager {
); );
return { return {
userInfo: userInfo, userInfo,
flow: flow, flow,
claims: claims, claims,
}; };
} }
} }

View file

@ -118,7 +118,7 @@ export class Relationship extends BaseInterface<
for (const subjectId of missingSubjectsIds) { for (const subjectId of missingSubjectsIds) {
await Relationship.insert({ await Relationship.insert({
ownerId: owner.id, ownerId: owner.id,
subjectId: subjectId, subjectId,
languages: [], languages: [],
following: false, following: false,
showingReblogs: false, showingReblogs: false,

View file

@ -167,12 +167,12 @@ export class Timeline<Type extends Note | User> {
case TimelineType.Note: case TimelineType.Note:
return { return {
link, link,
objects: objects, objects,
}; };
case TimelineType.User: case TimelineType.User:
return { return {
link, link,
objects: objects, objects,
}; };
} }
} }

View file

@ -22,8 +22,8 @@ const privateKey = await crypto.subtle.importKey(
beforeAll(async () => { beforeAll(async () => {
await db.insert(Applications).values({ await db.insert(Applications).values({
clientId: clientId, clientId,
redirectUri: redirectUri, redirectUri,
scopes: scope, scopes: scope,
name: "Test Application", name: "Test Application",
secret, secret,

View file

@ -287,7 +287,7 @@ export default (plugin: PluginType) =>
await db.insert(Tokens).values({ await db.insert(Tokens).values({
accessToken: randomString(64, "base64url"), accessToken: randomString(64, "base64url"),
code: code, code,
scope: scope ?? application.scopes, scope: scope ?? application.scopes,
tokenType: TokenType.Bearer, tokenType: TokenType.Bearer,
applicationId: application.id, applicationId: application.id,

View file

@ -15,8 +15,8 @@ beforeAll(async () => {
await db await db
.insert(Applications) .insert(Applications)
.values({ .values({
clientId: clientId, clientId,
redirectUri: redirectUri, redirectUri,
scopes: scope, scopes: scope,
name: "Test Application", name: "Test Application",
secret, secret,
@ -26,8 +26,8 @@ beforeAll(async () => {
await db.insert(Tokens).values({ await db.insert(Tokens).values({
code: "test-code", code: "test-code",
redirectUri: redirectUri, redirectUri,
clientId: clientId, clientId,
accessToken: "test-access-token", accessToken: "test-access-token",
expiresAt: new Date(Date.now() + 3600 * 1000).toISOString(), expiresAt: new Date(Date.now() + 3600 * 1000).toISOString(),
createdAt: new Date().toISOString(), createdAt: new Date().toISOString(),

View file

@ -12,8 +12,8 @@ const secret = "test-secret";
beforeAll(async () => { beforeAll(async () => {
await db.insert(Applications).values({ await db.insert(Applications).values({
clientId: clientId, clientId,
redirectUri: redirectUri, redirectUri,
scopes: scope, scopes: scope,
name: "Test Application", name: "Test Application",
secret, secret,
@ -21,8 +21,8 @@ beforeAll(async () => {
await db.insert(Tokens).values({ await db.insert(Tokens).values({
code: "test-code", code: "test-code",
redirectUri: redirectUri, redirectUri,
clientId: clientId, clientId,
accessToken: "test-access-token", accessToken: "test-access-token",
expiresAt: new Date(Date.now() + 3600 * 1000).toISOString(), expiresAt: new Date(Date.now() + 3600 * 1000).toISOString(),
createdAt: new Date().toISOString(), createdAt: new Date().toISOString(),

View file

@ -144,7 +144,7 @@ export const nodeDriver: RotatingFileSinkDriver<number> = {
} }
return statSync(path); return statSync(path);
}, },
renameSync: renameSync, renameSync,
}; };
export const configureLoggers = (silent = false) => export const configureLoggers = (silent = false) =>

View file

@ -26,7 +26,7 @@ export const renderMarkdownInPath = async (
} }
return { return {
content: content, content,
lastModified, lastModified,
}; };
}; };