Files
timelapse-backend/test/dbTester.js

29 lines
688 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.addProject('Test project', 'This is a test project');
console.log('Project added:', project);
await printProjects();
await databaseUtils.deleteProject(project.id);
await printProjects();
}
try {
testCreateDestroyProject();
} catch (error) {
console.error('Error:', error);
}
try {
printProjects();
} catch (error) {
console.error('Error:', error);
}