Updates to test to fix error. No 200 status code given and update for repeat user in DB

This commit is contained in:
Lucas Patenaude
2024-04-11 04:46:11 -06:00
parent 003c554db7
commit 69fe8fb1b8
2 changed files with 2 additions and 2 deletions

View File

@@ -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' });

View File

@@ -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