fix(#1): Address code review findings
- Convert ApiResponse to discriminated union for type-safe error handling - Add HealthStatus type with HealthState literal union - Make BaseEntity fields readonly for immutability - Add GlobalExceptionFilter with structured logging - Add port validation with clear error messages in main.ts - Improve parseDate to log warnings for invalid dates - Add comprehensive Button tests (variants, onClick, disabled) - Add slugify edge case tests (empty, special chars, numbers) - Create ESLint configs for all packages - Remove compiled JS files from src directories - Convert .prettierrc.js to .prettierrc.json Refs #1 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,38 @@ describe("slugify", () => {
|
||||
it("should trim leading and trailing hyphens", () => {
|
||||
expect(slugify(" Hello World ")).toBe("hello-world");
|
||||
});
|
||||
|
||||
it("should handle empty string", () => {
|
||||
expect(slugify("")).toBe("");
|
||||
});
|
||||
|
||||
it("should handle string with only whitespace", () => {
|
||||
expect(slugify(" ")).toBe("");
|
||||
});
|
||||
|
||||
it("should handle consecutive special characters", () => {
|
||||
expect(slugify("Hello---World")).toBe("hello-world");
|
||||
expect(slugify("Hello___World")).toBe("hello-world");
|
||||
expect(slugify("Hello World")).toBe("hello-world");
|
||||
});
|
||||
|
||||
it("should handle numbers", () => {
|
||||
expect(slugify("Product 123")).toBe("product-123");
|
||||
expect(slugify("2024 New Year")).toBe("2024-new-year");
|
||||
});
|
||||
|
||||
it("should handle mixed case", () => {
|
||||
expect(slugify("HeLLo WoRLd")).toBe("hello-world");
|
||||
});
|
||||
|
||||
it("should remove leading/trailing special chars", () => {
|
||||
expect(slugify("---Hello World---")).toBe("hello-world");
|
||||
expect(slugify("!@#Hello World!@#")).toBe("hello-world");
|
||||
});
|
||||
|
||||
it("should handle string with only special characters", () => {
|
||||
expect(slugify("!@#$%^&*()")).toBe("");
|
||||
});
|
||||
});
|
||||
|
||||
describe("sleep", () => {
|
||||
|
||||
Reference in New Issue
Block a user