|  |  | @ -4,6 +4,7 @@ import { db } from '../../../src/db'; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | // Store original globals
 |  |  |  | // Store original globals
 | 
			
		
	
		
		
			
				
					
					|  |  |  | const originalFetch = globalThis.fetch; |  |  |  | const originalFetch = globalThis.fetch; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | const originalConsoleError = console.error; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | describe('GroupSyncService', () => { |  |  |  | describe('GroupSyncService', () => { | 
			
		
	
		
		
			
				
					
					|  |  |  |   let fetchMock: any; |  |  |  |   let fetchMock: any; | 
			
		
	
	
		
		
			
				
					|  |  | @ -46,8 +47,21 @@ describe('GroupSyncService', () => { | 
			
		
	
		
		
			
				
					
					|  |  |  |     }); |  |  |  |     }); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     it('should throw if WHATSAPP_COMMUNITY_ID is missing', async () => { |  |  |  |     it('should throw if WHATSAPP_COMMUNITY_ID is missing', async () => { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       const consoleErrorMock = mock(() => {}); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       console.error = consoleErrorMock; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |        | 
			
		
	
		
		
			
				
					
					|  |  |  |       process.env.WHATSAPP_COMMUNITY_ID = ''; |  |  |  |       process.env.WHATSAPP_COMMUNITY_ID = ''; | 
			
		
	
		
		
			
				
					
					|  |  |  |       await expect(GroupSyncService.syncGroups()).rejects.toThrow('WHATSAPP_COMMUNITY_ID is not set'); |  |  |  |        | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       await expect(GroupSyncService.syncGroups()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         .rejects.toThrow('WHATSAPP_COMMUNITY_ID is not set'); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |        | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       expect(consoleErrorMock).toHaveBeenCalledWith( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         'Group sync failed:', | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         expect.any(Error) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |        | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       // Restore original console.error
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       console.error = originalConsoleError; | 
			
		
	
		
		
			
				
					
					|  |  |  |     }); |  |  |  |     }); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     it('should filter groups by community ID', async () => { |  |  |  |     it('should filter groups by community ID', async () => { | 
			
		
	
	
		
		
			
				
					|  |  | 
 |