27 lines
723 B
JavaScript
27 lines
723 B
JavaScript
const databaseUtils = require('../utils/dbUtils');
|
|
|
|
console.log('Testing database functions...');
|
|
|
|
async function printProjects() {
|
|
const projects = await databaseUtils.projectsTable.getAll();
|
|
console.log('Projects:', projects);
|
|
}
|
|
|
|
async function testCreateDestroyProject() {
|
|
const project = await databaseUtils.projectsTable.create('Test Project', 'This is a test project', new Date(), 0);
|
|
console.log('Created project:', project);
|
|
await databaseUtils.projectsTable.delete(project.id);
|
|
console.log('Deleted project:', project);
|
|
}
|
|
|
|
try {
|
|
testCreateDestroyProject();
|
|
} catch (error) {
|
|
console.error('Error:', error);
|
|
}
|
|
|
|
try {
|
|
printProjects();
|
|
} catch (error) {
|
|
console.error('Error:', error);
|
|
} |