mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 08:32:09 +01:00
feat: implement platform management system with authentication and dashboard
- Add PlatformUser model with roles (SUPER_ADMIN, ADMIN, SUPPORT) - Implement platform authentication with NextAuth - Create platform dashboard showing companies, users, and sessions - Add platform API endpoints for company management - Update landing page with SaaS design - Include test improvements and accessibility updates
This commit is contained in:
@ -56,7 +56,7 @@ describe("Accessibility Tests", () => {
|
||||
);
|
||||
|
||||
await screen.findByText("User Management");
|
||||
|
||||
|
||||
// Basic accessibility check - most critical violations would be caught here
|
||||
const results = await axe(container);
|
||||
expect(results.violations.length).toBeLessThan(5); // Allow minor violations
|
||||
@ -189,11 +189,11 @@ describe("Accessibility Tests", () => {
|
||||
|
||||
const emailInput = screen.getByLabelText("Email");
|
||||
const submitButton = screen.getByRole("button", { name: /invite user/i });
|
||||
|
||||
|
||||
// Elements should be focusable
|
||||
emailInput.focus();
|
||||
expect(emailInput).toHaveFocus();
|
||||
|
||||
|
||||
submitButton.focus();
|
||||
expect(submitButton).toHaveFocus();
|
||||
});
|
||||
|
||||
@ -99,7 +99,7 @@ describe("Format Enums Utility", () => {
|
||||
it("should be an alias for formatEnumValue", () => {
|
||||
const testValues = [
|
||||
"SALARY_COMPENSATION",
|
||||
"SCHEDULE_HOURS",
|
||||
"SCHEDULE_HOURS",
|
||||
"UNKNOWN_ENUM",
|
||||
null,
|
||||
undefined,
|
||||
@ -129,7 +129,7 @@ describe("Format Enums Utility", () => {
|
||||
it("should handle very long enum values", () => {
|
||||
const longEnum = "A".repeat(100) + "_" + "B".repeat(100);
|
||||
const result = formatEnumValue(longEnum);
|
||||
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
expect(result?.length).toBeGreaterThan(200);
|
||||
expect(result?.includes(" ")).toBeTruthy();
|
||||
@ -150,16 +150,16 @@ describe("Format Enums Utility", () => {
|
||||
it("should be performant with many calls", () => {
|
||||
const testEnum = "SALARY_COMPENSATION";
|
||||
const iterations = 1000;
|
||||
|
||||
|
||||
const startTime = performance.now();
|
||||
|
||||
|
||||
for (let i = 0; i < iterations; i++) {
|
||||
formatEnumValue(testEnum);
|
||||
}
|
||||
|
||||
|
||||
const endTime = performance.now();
|
||||
const duration = endTime - startTime;
|
||||
|
||||
|
||||
// Should complete 1000 calls in reasonable time (less than 100ms)
|
||||
expect(duration).toBeLessThan(100);
|
||||
});
|
||||
@ -208,7 +208,7 @@ describe("Format Enums Utility", () => {
|
||||
it("should provide readable text for badges and labels", () => {
|
||||
const badgeValues = [
|
||||
"ADMIN",
|
||||
"USER",
|
||||
"USER",
|
||||
"AUDITOR",
|
||||
"UNRECOGNIZED_OTHER",
|
||||
];
|
||||
@ -249,7 +249,7 @@ describe("Format Enums Utility", () => {
|
||||
// Future enum values should still be formatted reasonably
|
||||
const futureEnums = [
|
||||
"REMOTE_WORK_POLICY",
|
||||
"SUSTAINABILITY_INITIATIVES",
|
||||
"SUSTAINABILITY_INITIATIVES",
|
||||
"DIVERSITY_INCLUSION",
|
||||
"MENTAL_HEALTH_SUPPORT",
|
||||
];
|
||||
|
||||
@ -52,7 +52,7 @@ describe("Keyboard Navigation Tests", () => {
|
||||
|
||||
roleSelect.focus();
|
||||
expect(roleSelect).toBeInTheDocument();
|
||||
|
||||
|
||||
submitButton.focus();
|
||||
expect(document.activeElement).toBe(submitButton);
|
||||
});
|
||||
@ -84,7 +84,7 @@ describe("Keyboard Navigation Tests", () => {
|
||||
|
||||
// Submit with Enter key
|
||||
fireEvent.keyDown(submitButton, { key: "Enter" });
|
||||
|
||||
|
||||
// Form should be submitted (fetch called for initial load + submission)
|
||||
expect(global.fetch).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
@ -117,7 +117,7 @@ describe("Keyboard Navigation Tests", () => {
|
||||
// Activate with Space key
|
||||
submitButton.focus();
|
||||
fireEvent.keyDown(submitButton, { key: " " });
|
||||
|
||||
|
||||
// Should trigger form submission (fetch called for initial load + submission)
|
||||
expect(global.fetch).toHaveBeenCalledTimes(3);
|
||||
});
|
||||
@ -153,7 +153,7 @@ describe("Keyboard Navigation Tests", () => {
|
||||
|
||||
// Press Escape
|
||||
fireEvent.keyDown(emailInput, { key: "Escape" });
|
||||
|
||||
|
||||
// Field should not be cleared by Escape (browser default behavior)
|
||||
// But it should not cause any errors
|
||||
expect(emailInput.value).toBe("test@example.com");
|
||||
@ -173,7 +173,7 @@ describe("Keyboard Navigation Tests", () => {
|
||||
// Arrow keys should work (implementation depends on Select component)
|
||||
fireEvent.keyDown(roleSelect, { key: "ArrowDown" });
|
||||
fireEvent.keyDown(roleSelect, { key: "ArrowUp" });
|
||||
|
||||
|
||||
// Should not throw errors
|
||||
expect(roleSelect).toBeInTheDocument();
|
||||
});
|
||||
@ -292,7 +292,7 @@ describe("Keyboard Navigation Tests", () => {
|
||||
);
|
||||
|
||||
const chart = screen.getByRole("img", { name: /test chart/i });
|
||||
|
||||
|
||||
// Chart should be focusable
|
||||
chart.focus();
|
||||
expect(chart).toHaveFocus();
|
||||
@ -311,7 +311,7 @@ describe("Keyboard Navigation Tests", () => {
|
||||
);
|
||||
|
||||
const chart = screen.getByRole("img", { name: /test chart/i });
|
||||
|
||||
|
||||
chart.focus();
|
||||
|
||||
// Test keyboard interactions
|
||||
@ -395,7 +395,7 @@ describe("Keyboard Navigation Tests", () => {
|
||||
// Should handle focus on disabled elements gracefully
|
||||
submitButton.focus();
|
||||
fireEvent.keyDown(submitButton, { key: "Enter" });
|
||||
|
||||
|
||||
// Should not cause errors
|
||||
});
|
||||
|
||||
@ -515,7 +515,7 @@ describe("Keyboard Navigation Tests", () => {
|
||||
await screen.findByText("User Management");
|
||||
|
||||
const emailInput = screen.getByLabelText("Email");
|
||||
|
||||
|
||||
// Focus should still work in high contrast mode
|
||||
emailInput.focus();
|
||||
expect(emailInput).toHaveFocus();
|
||||
|
||||
@ -263,7 +263,7 @@ describe("UserManagementPage", () => {
|
||||
|
||||
await waitFor(() => {
|
||||
const emailInput = screen.getByLabelText("Email") as HTMLInputElement;
|
||||
|
||||
|
||||
fireEvent.change(emailInput, { target: { value: "invalid-email" } });
|
||||
fireEvent.blur(emailInput);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user