diff --git a/ProjectSourceCode/src/index.js b/ProjectSourceCode/src/index.js index ff137fd..ea59815 100644 --- a/ProjectSourceCode/src/index.js +++ b/ProjectSourceCode/src/index.js @@ -163,7 +163,7 @@ app.post('/register', async (req, res) => { await db.none('INSERT INTO users (username, password) VALUES ($1, $2)', [req.body.username, hash]); // Redirect user to the login page after successful registration - res.redirect('/home'); + res.status(200).json({ status: 'success', message: 'Registration successful' }); } catch (error) { // If an error occurs during registration, respond with status 500 and an error message res.status(500).json({ status: 'error', message: 'An error occurred during registration' }); diff --git a/ProjectSourceCode/test/server.spec.js b/ProjectSourceCode/test/server.spec.js index 3ebd73f..a082ba1 100644 --- a/ProjectSourceCode/test/server.spec.js +++ b/ProjectSourceCode/test/server.spec.js @@ -36,7 +36,7 @@ describe('Server!', () => { it('positive: /register', done => { // Define mock user data const userData = { - username: 'Vishal', + username: 'Test User', password: '123456' }; // Make a POST request to /register with mock user data