Linting cleanup (#99)

* Add eslint and prettier dependencies and configs

* Lint project.
This commit is contained in:
Antonis Anastasiadis 2025-07-01 11:40:09 +03:00 committed by GitHub
parent dd6ec117d0
commit e594d1075b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
97 changed files with 26554 additions and 39840 deletions

View file

@ -6,37 +6,43 @@ const fs = require('fs');
const path = require('path');
beforeAll(async () => {
// Ensure test database is clean and created
await sequelize.sync({ force: true });
// Ensure test database is clean and created
await sequelize.sync({ force: true });
}, 30000);
beforeEach(async () => {
// Clean all tables except Sessions to avoid conflicts
try {
const models = Object.values(sequelize.models);
const nonSessionModels = models.filter(model => model.name !== 'Session');
await Promise.all(nonSessionModels.map(model => model.destroy({ truncate: true, cascade: true })));
} catch (error) {
// Ignore errors during cleanup
}
// Clean all tables except Sessions to avoid conflicts
try {
const models = Object.values(sequelize.models);
const nonSessionModels = models.filter(
(model) => model.name !== 'Session'
);
await Promise.all(
nonSessionModels.map((model) =>
model.destroy({ truncate: true, cascade: true })
)
);
} catch (error) {
// Ignore errors during cleanup
}
});
afterEach(async () => {
// Clean up sessions after each test
try {
const Session = sequelize.models.Session;
if (Session) {
await Session.destroy({ truncate: true });
// Clean up sessions after each test
try {
const Session = sequelize.models.Session;
if (Session) {
await Session.destroy({ truncate: true });
}
} catch (error) {
// Ignore errors during session cleanup
}
} catch (error) {
// Ignore errors during session cleanup
}
});
afterAll(async () => {
try {
await sequelize.close();
} catch (error) {
// Database may already be closed
}
}, 30000);
try {
await sequelize.close();
} catch (error) {
// Database may already be closed
}
}, 30000);