From 3346dae465e5526bd4a89fb8b26e531efc4d046e Mon Sep 17 00:00:00 2001 From: azures04 Date: Tue, 27 Jan 2026 05:56:44 +0100 Subject: [PATCH] Fix SQL syntax and add user registration test Corrected a SQL syntax error in the databaseGlobals.js by removing an extraneous comma. Added a test script (test.js) to initialize the database and test user registration functionality. --- modules/databaseGlobals.js | 2 +- test.js | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/modules/databaseGlobals.js b/modules/databaseGlobals.js index 8af8308..7a4bdb3 100644 --- a/modules/databaseGlobals.js +++ b/modules/databaseGlobals.js @@ -68,7 +68,7 @@ function initializeDatabase() { FOREIGN KEY(productId) REFERENCES products(id) - ON DELETE CASCADE, + ON DELETE CASCADE ) `) } diff --git a/test.js b/test.js index e69de29..15eac29 100644 --- a/test.js +++ b/test.js @@ -0,0 +1,19 @@ +const globals = require("./modules/databaseGlobals") +const userService = require("./services/userService") + +async function main() { + globals.initializeDatabase() + try { + const result = await userService.register({ + firstName: "User", + lastName: "Root", + username: "admin", + password: "changme" + }) + console.log(result) + } catch (error) { + console.error(error) + } +} + +main() \ No newline at end of file