fix: resolve Prettier markdown code block parsing errors

- Fix syntax errors in skills markdown files (.github/skills, .opencode/skills)
- Change typescript to tsx for code blocks with JSX
- Replace ellipsis (...) in array examples with valid syntax
- Separate CSS from TypeScript into distinct code blocks
- Convert JavaScript object examples to valid JSON in docs
- Fix enum definitions with proper comma separation
This commit is contained in:
2026-01-20 21:09:29 +01:00
parent 7932fe7386
commit cd05fc8648
177 changed files with 5042 additions and 5541 deletions

View File

@@ -1,9 +1,13 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
// Mock modules before imports
vi.mock("next-auth/react", () => ({
useSession: vi.fn(),
SessionProvider: ({ children }: { children: React.ReactNode }) => children,
// Mock auth client
vi.mock("../../lib/auth/client", () => ({
authClient: {
useSession: vi.fn(() => ({
data: { session: null, user: null },
isPending: false,
})),
},
}));
vi.mock("next/navigation", () => ({
@@ -22,30 +26,37 @@ describe("Platform Dashboard", () => {
describe("Authentication", () => {
it("should require platform user authentication", () => {
// Test that the dashboard checks for platform user authentication
const mockSession = {
user: {
email: "admin@notso.ai",
isPlatformUser: true,
platformRole: "SUPER_ADMIN",
},
expires: new Date().toISOString(),
// Test that the dashboard checks for platform user role
const platformUser = {
id: "1",
email: "admin@notso.ai",
role: "PLATFORM_SUPER_ADMIN",
companyId: null,
};
expect(mockSession.user.isPlatformUser).toBe(true);
expect(mockSession.user.platformRole).toBeTruthy();
const isPlatformRole = (role: string) =>
["PLATFORM_SUPER_ADMIN", "PLATFORM_ADMIN", "PLATFORM_SUPPORT"].includes(
role
);
expect(isPlatformRole(platformUser.role)).toBe(true);
expect(platformUser.companyId).toBeNull();
});
it("should not allow regular users", () => {
const mockSession = {
user: {
email: "regular@user.com",
isPlatformUser: false,
},
expires: new Date().toISOString(),
const regularUser = {
id: "2",
email: "regular@user.com",
role: "USER",
companyId: "company-123",
};
expect(mockSession.user.isPlatformUser).toBe(false);
const isPlatformRole = (role: string) =>
["PLATFORM_SUPER_ADMIN", "PLATFORM_ADMIN", "PLATFORM_SUPPORT"].includes(
role
);
expect(isPlatformRole(regularUser.role)).toBe(false);
});
});
@@ -93,20 +104,21 @@ describe("Platform Dashboard", () => {
describe("Platform Roles", () => {
it("should support all platform roles", () => {
const roles = [
{ role: "SUPER_ADMIN", canEdit: true },
{ role: "ADMIN", canEdit: true },
{ role: "SUPPORT", canEdit: false },
{ role: "PLATFORM_SUPER_ADMIN", canEdit: true },
{ role: "PLATFORM_ADMIN", canEdit: true },
{ role: "PLATFORM_SUPPORT", canEdit: false },
];
roles.forEach(({ role, canEdit }) => {
const user = {
id: "1",
email: `${role.toLowerCase()}@notso.ai`,
isPlatformUser: true,
platformRole: role,
role: role,
companyId: null,
};
expect(user.platformRole).toBe(role);
if (role === "SUPER_ADMIN" || role === "ADMIN") {
expect(user.role).toBe(role);
if (role === "PLATFORM_SUPER_ADMIN" || role === "PLATFORM_ADMIN") {
expect(canEdit).toBe(true);
} else {
expect(canEdit).toBe(false);