style: format code biome
Local Build and Deploy / deploy (push) Failing after 46s

This commit is contained in:
openhands committed 2026-07-13 21:57:41 +02:00
1 parent 8efd032cc6
commit df38dccbf1
735 files changed
+128321 -120870

No files matched your search

+31 -17
View File
@@ -1,24 +1,38 @@
import { describe, expect, it } from "vitest";
import { resolveAuthorizationState } from "@/lib/admin/rank-authority";
function db(user: { id: number; username: string; rank: number } | null, highest: number | null) {
return {
user: { findUnique: async () => user },
highestRank: async () => highest,
};
function db(
user: { id: number; username: string; rank: number } | null,
highest: number | null,
) {
return {
user: { findUnique: async () => user },
highestRank: async () => highest,
};
}
describe("resolveAuthorizationState", () => {
it("uses current database rank and highest rank 2000", async () => {
await expect(
resolveAuthorizationState(7, db({ id: 7, username: "root", rank: 2000 }, 2000)),
).resolves.toEqual({ actor: { id: 7, username: "root", rank: 2000 }, highestRank: 2000 });
});
it("returns null for a deleted user", async () =>
expect(resolveAuthorizationState(7, db(null, 2000))).resolves.toBeNull());
it("fails closed when there are no ranks", async () =>
expect(resolveAuthorizationState(7, db({ id: 7, username: "root", rank: 1 }, null))).resolves.toEqual({
actor: { id: 7, username: "root", rank: 1 },
highestRank: null,
}));
it("uses current database rank and highest rank 2000", async () => {
await expect(
resolveAuthorizationState(
7,
db({ id: 7, username: "root", rank: 2000 }, 2000),
),
).resolves.toEqual({
actor: { id: 7, username: "root", rank: 2000 },
highestRank: 2000,
});
});
it("returns null for a deleted user", async () =>
expect(resolveAuthorizationState(7, db(null, 2000))).resolves.toBeNull());
it("fails closed when there are no ranks", async () =>
expect(
resolveAuthorizationState(
7,
db({ id: 7, username: "root", rank: 1 }, null),
),
).resolves.toEqual({
actor: { id: 7, username: "root", rank: 1 },
highestRank: null,
}));
});