From dec9dc489753ff459020ce83c2360b01caa2ff62 Mon Sep 17 00:00:00 2001 From: Tiago Yamamoto Date: Wed, 24 Dec 2025 16:32:25 -0300 Subject: [PATCH] fix(frontend): fix TypeScript errors in auth.test.ts - Add 'as const' to role literals for proper type inference - Fixes build error: Type 'string' not assignable to 'candidate' | 'admin' | 'company' --- frontend/src/lib/__tests__/auth.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/lib/__tests__/auth.test.ts b/frontend/src/lib/__tests__/auth.test.ts index dc1bf72..297329f 100644 --- a/frontend/src/lib/__tests__/auth.test.ts +++ b/frontend/src/lib/__tests__/auth.test.ts @@ -194,17 +194,17 @@ describe('Auth Module', () => { describe('isAdminUser', () => { it('should return true for admin role', () => { - const adminUser = { id: '1', name: 'Admin', email: 'a@a.com', role: 'admin', roles: ['admin'] }; + const adminUser = { id: '1', name: 'Admin', email: 'a@a.com', role: 'admin' as const, roles: ['admin'] }; expect(authModule.isAdminUser(adminUser)).toBe(true); }); it('should return true for SUPERADMIN in roles array', () => { - const superAdmin = { id: '1', name: 'Super', email: 's@s.com', role: 'candidate', roles: ['SUPERADMIN'] }; + const superAdmin = { id: '1', name: 'Super', email: 's@s.com', role: 'candidate' as const, roles: ['SUPERADMIN'] }; expect(authModule.isAdminUser(superAdmin)).toBe(true); }); it('should return false for regular candidate', () => { - const candidate = { id: '1', name: 'User', email: 'u@u.com', role: 'candidate', roles: ['CANDIDATE'] }; + const candidate = { id: '1', name: 'User', email: 'u@u.com', role: 'candidate' as const, roles: ['CANDIDATE'] }; expect(authModule.isAdminUser(candidate)).toBe(false); });