Skip to content

Commit

Permalink
Pushing jest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
muzammil-13 committed Dec 22, 2024
1 parent dbe0623 commit 0fca253
Show file tree
Hide file tree
Showing 7 changed files with 11,115 additions and 1,291 deletions.
27 changes: 27 additions & 0 deletions backend/__tests__/auth.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const request = require('supertest');
const app = require('../index'); // Adjust path as needed

describe('Auth Endpoints', () => {
test('should register a new user', async () => {
const res = await request(app)
.post('/api/auth/register')
.send({
email: '[email protected]',
password: 'password123',
name: 'Test User'
});
expect(res.statusCode).toBe(201);
expect(res.body).toHaveProperty('token');
});

test('should login existing user', async () => {
const res = await request(app)
.post('/api/auth/login')
.send({
email: '[email protected]',
password: 'password123'
});
expect(res.statusCode).toBe(200);
expect(res.body).toHaveProperty('token');
});
});
7 changes: 7 additions & 0 deletions backend/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
testEnvironment: 'node',
testMatch: ['**/__tests__/**/*.js', '**/?(*.)+(spec|test).js'],
collectCoverage: true,
coverageDirectory: 'coverage',
};

Loading

0 comments on commit 0fca253

Please sign in to comment.