File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ export type LinkryAdminGetResponse = z.infer<typeof getLinkryAdminSchema>;
6666
6767export  const  LinkShortenerAdmin : React . FC  =  ( )  =>  { 
6868  const  [ isLoading ,  setIsLoading ]  =  useState < boolean > ( false ) ; 
69-   const  [ adminLinks ,  setAdminLinks ]  =  useState < LinkryAdminGetResponse [ ] > ( [ ] ) ; 
69+   const  [ adminLinks ,  setAdminLinks ]  =  useState < LinkryGetResponse [ ] > ( [ ] ) ; 
7070  const  api  =  useApi ( 'core' ) ; 
7171  const  [ opened ,  {  open,  close } ]  =  useDisclosure ( false ) ; 
7272  const  [ showPrevious ,  {  toggle : togglePrevious  } ]  =  useDisclosure ( false ) ;  // Changed default to false 
Original file line number Diff line number Diff line change @@ -62,14 +62,24 @@ ddbMock.on(QueryCommand).resolves({
6262  Items : [ ] , 
6363} ) ; 
6464
65- const  testJwt  =  createJwt ( undefined ,  "83c275f8-e533-4987-b537-a94b86c9d28e" ) ; 
65+ const  testAdminJwt  =  createJwt ( undefined ,  "LINKS_ADMIN" ) ; 
66+ const  testAccessDeniedJwt  =  createJwt ( undefined ,  "1" ) ; 
6667
67- const  allLinkryResponse  =  await  app . inject ( { 
68+ const  adminLinkryResponse  =  await  app . inject ( { 
6869  method : "GET" , 
6970  url : "/api/v1/linkry/redir" , 
7071  headers : { 
71-     Authorization : `Bearer ${ testJwt }  ` , 
72+     Authorization : `Bearer ${ testAdminJwt }  ` , 
7273  } , 
7374} ) ; 
7475
75- expect ( allLinkryResponse . statusCode ) . toBe ( 200 ) ; 
76+ const  accessDeniedLinkryResponse  =  await  app . inject ( { 
77+   method : "GET" , 
78+   url : "/api/v1/linkry/redir" , 
79+   headers : { 
80+     Authorization : `Bearer ${ testAccessDeniedJwt }  ` , 
81+   } , 
82+ } ) ; 
83+ 
84+ expect ( adminLinkryResponse . statusCode ) . toBe ( 200 ) ; 
85+ expect ( accessDeniedLinkryResponse . statusCode ) . toBe ( 401 ) ; 
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ vi.mock(
4242        const  mockGroupRoles  =  { 
4343          "0" : allAppRoles , 
4444          "1" : [ ] , 
45+           LINKS_ADMIN : [ AppRoles . LINKS_ADMIN ] , 
4546          "scanner-only" : [ AppRoles . TICKETS_SCANNER ] , 
4647        } ; 
4748
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments