feat: integration tests CRUD 34/34 (supertest + real DB)
This commit is contained in:
@@ -157,8 +157,15 @@ async function start() {
|
||||
.then(() => console.log('DB connected'))
|
||||
.catch(e => console.error('DB not ready:', e.message));
|
||||
|
||||
app.listen(PORT, () => console.log('Server on port ' + PORT));
|
||||
return app;
|
||||
}
|
||||
|
||||
start().catch(e => { console.error('Startup error:', e); process.exit(1); });
|
||||
// Запускаем сервер только если файл запущен напрямую (не через require)
|
||||
if (require.main === module) {
|
||||
start()
|
||||
.then(a => a.listen(PORT, () => console.log('Server on port ' + PORT)))
|
||||
.catch(e => { console.error('Startup error:', e); process.exit(1); });
|
||||
}
|
||||
|
||||
module.exports = { start };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user