You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			19 lines
		
	
	
		
			719 B
		
	
	
	
		
			TypeScript
		
	
			
		
		
	
	
			19 lines
		
	
	
		
			719 B
		
	
	
	
		
			TypeScript
		
	
| import { describe, it, expect } from 'bun:test';
 | |
| import Database from 'bun:sqlite';
 | |
| import { initializeDatabase } from '../../../src/db';
 | |
| 
 | |
| describe('DB migrations smoke', () => {
 | |
|   it('initializeDatabase en :memory: no lanza y crea tablas base', () => {
 | |
|     const memdb = new Database(':memory:');
 | |
|     expect(() => initializeDatabase(memdb)).not.toThrow();
 | |
| 
 | |
|     // Comprobar que al menos una tabla base existe (users, tasks o response_queue).
 | |
|     const rows = memdb
 | |
|       .query(`SELECT name FROM sqlite_master WHERE type='table' AND name IN ('users','tasks','response_queue')`)
 | |
|       .all() as Array<{ name: string }>;
 | |
| 
 | |
|     expect(Array.isArray(rows)).toBe(true);
 | |
|     expect(rows.length).toBeGreaterThan(0);
 | |
|   });
 | |
| });
 |