feat: integration tests CRUD 34/34 (supertest + real DB)

This commit is contained in:
2026-05-30 17:06:42 +03:00
parent 093b96b9ae
commit e97c36f19f
5 changed files with 742 additions and 4 deletions
+9 -2
View File
@@ -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 };