- Introduce Vitest per Unit e Integration Test. - Introduce Playwright per End-to-End Test. - Aggiuge documentazione dettagliata in tests/README.md. - Aggiorna .gitignore per escludere i report di coverage
23 lines
736 B
JavaScript
23 lines
736 B
JavaScript
import { describe, it, expect } from 'vitest'
|
|
import { printServerInfo } from '../../src/server-utils.js'
|
|
|
|
// Mocking console.log per evitare output sporchi durante i test
|
|
import { vi } from 'vitest'
|
|
|
|
describe('Server Utils', () => {
|
|
it('printServerInfo dovrebbe stampare le porte corrette', () => {
|
|
const consoleSpy = vi.spyOn(console, 'log')
|
|
printServerInfo(3000, 3001)
|
|
|
|
expect(consoleSpy).toHaveBeenCalled()
|
|
|
|
// Unisce tutti i messaggi loggati in un'unica stringa per facilitare la ricerca
|
|
const allLogs = consoleSpy.mock.calls.map(args => args[0]).join('\n')
|
|
|
|
expect(allLogs).toContain('3000')
|
|
expect(allLogs).toContain('3001')
|
|
|
|
consoleSpy.mockRestore()
|
|
})
|
|
})
|