28 lines
685 B
JavaScript
28 lines
685 B
JavaScript
const databaseUtils = require('../utils/dbUtils');
|
|
|
|
console.log('Testing database functions...');
|
|
|
|
async function printProjects() {
|
|
const projects = await databaseUtils.getProjects();
|
|
console.log('Projects:', projects);
|
|
}
|
|
|
|
async function testCreateDestroyProject() {
|
|
const project = await databaseUtils.createProject('Test project', 'Test description', new Date(), 0);
|
|
console.log('Project created:', project);
|
|
|
|
await databaseUtils.deleteProject(project.id);
|
|
console.log('Project deleted');
|
|
}
|
|
|
|
try {
|
|
testCreateDestroyProject();
|
|
} catch (error) {
|
|
console.error('Error:', error);
|
|
}
|
|
|
|
try {
|
|
printProjects();
|
|
} catch (error) {
|
|
console.error('Error:', error);
|
|
} |