|  |  | @ -76,6 +76,29 @@ describe('Database', () => { | 
			
		
	
		
		
			
				
					
					|  |  |  |     }); |  |  |  |     }); | 
			
		
	
		
		
			
				
					
					|  |  |  |   }); |  |  |  |   }); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   describe('User Operations', () => { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     test('should reject duplicate user IDs', () => { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       // First insert should succeed
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       const firstInsert = db.prepare(` | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         INSERT INTO users (id) VALUES ('34650112233') | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       `).run();
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       expect(firstInsert.changes).toBe(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       // Second insert with same ID should fail
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       expect(() => { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         db.prepare(` | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           INSERT INTO users (id) VALUES ('34650112233') | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         `).run();
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       }).toThrow(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       // Verify only one record exists
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       const count = db.prepare(` | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         SELECT COUNT(*) as count FROM users WHERE id = '34650112233' | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       `).get();
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       expect(count.count).toBe(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     }); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   }); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   describe('Data Operations', () => { |  |  |  |   describe('Data Operations', () => { | 
			
		
	
		
		
			
				
					
					|  |  |  |     beforeEach(() => { |  |  |  |     beforeEach(() => { | 
			
		
	
		
		
			
				
					
					|  |  |  |       db.exec(` |  |  |  |       db.exec(` | 
			
		
	
	
		
		
			
				
					|  |  | 
 |