Improvements: remove dead config, fix ESM, add URL validation, unify types, add missing logging
Deploy / release (push) Skipped
Deploy / deploy (push) Successful in 1m52s

- Remove .prettierrc (dead config, Biome replaces Prettier)
- Rename lighthouserc.json to lighthouserc.cjs with module.exports for ESM compat
- Add logger.warn to empty catch blocks in auth, register, site-settings, prisma-cache, redis, security, rate-limit
- Unify ActionResult type: action-helper.ts uses 'ok' consistent with safe-action-shared.ts
- Add noUnusedLocals + noUnusedParameters to tsconfig + fix 25 pre-existing unused vars
- Replace barrel export src/types/index.ts with direct @/types/common imports
- Make trustHost conditional (development only) in auth.ts
- Add pre-flight URL validation to update-Nitrov3.sh to catch image.library.url misconfigurations
- Improve NITRO_IMAGE_LIBRARY_URL content validation in pre-flight & post-compute checks
This commit is contained in:
openhands committed 2026-07-26 20:28:11 +02:00
1 parent b922f6d49f
commit 17847545dd
292 files changed
+69195 -67915

No files matched your search

+31 -46
View File
@@ -1,10 +1,10 @@
import { describe, expect, it } from "vitest";
import {
createUserSchema,
updateUserSchema,
banUserSchema,
createUserSchema,
giveBadgeSchema,
updateUserSchema,
} from "./user";
describe("createUserSchema", () => {
@@ -23,61 +23,51 @@ describe("createUserSchema", () => {
it("rejects short username (< 3 chars)", () => {
expect(
createUserSchema
.safeParse({
username: "ab",
mail: "[email protected]",
password: "secret123",
})
.success,
createUserSchema.safeParse({
username: "ab",
mail: "[email protected]",
password: "secret123",
}).success,
).toBe(false);
});
it("rejects long username (> 20 chars)", () => {
expect(
createUserSchema
.safeParse({
username: "a".repeat(21),
mail: "[email protected]",
password: "secret123",
})
.success,
createUserSchema.safeParse({
username: "a".repeat(21),
mail: "[email protected]",
password: "secret123",
}).success,
).toBe(false);
});
it("rejects invalid username characters", () => {
expect(
createUserSchema
.safeParse({
username: "user@name",
mail: "[email protected]",
password: "secret123",
})
.success,
createUserSchema.safeParse({
username: "user@name",
mail: "[email protected]",
password: "secret123",
}).success,
).toBe(false);
});
it("rejects invalid email", () => {
expect(
createUserSchema
.safeParse({
username: "TestUser",
mail: "not-an-email",
password: "secret123",
})
.success,
createUserSchema.safeParse({
username: "TestUser",
mail: "not-an-email",
password: "secret123",
}).success,
).toBe(false);
});
it("rejects short password (< 6 chars)", () => {
expect(
createUserSchema
.safeParse({
username: "TestUser",
mail: "[email protected]",
password: "12345",
})
.success,
createUserSchema.safeParse({
username: "TestUser",
mail: "test@example.com",
password: "12345",
}).success,
).toBe(false);
});
});
@@ -95,9 +85,7 @@ describe("updateUserSchema", () => {
});
it("rejects rank out of range", () => {
expect(
updateUserSchema.safeParse({ rank: 8 }).success,
).toBe(false);
expect(updateUserSchema.safeParse({ rank: 8 }).success).toBe(false);
});
});
@@ -124,16 +112,13 @@ describe("banUserSchema", () => {
it("rejects empty reason", () => {
expect(
banUserSchema
.safeParse({ userId: 1, reason: "", duration: 1 })
.success,
banUserSchema.safeParse({ userId: 1, reason: "", duration: 1 }).success,
).toBe(false);
});
it("rejects negative duration", () => {
expect(
banUserSchema
.safeParse({ userId: 1, reason: "Bad", duration: -1 })
banUserSchema.safeParse({ userId: 1, reason: "Bad", duration: -1 })
.success,
).toBe(false);
});
@@ -153,4 +138,4 @@ describe("giveBadgeSchema", () => {
giveBadgeSchema.safeParse({ userId: 1, badgeCode: "" }).success,
).toBe(false);
});
});
});