-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbe0623
commit 0fca253
Showing
7 changed files
with
11,115 additions
and
1,291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}; | ||
|
Oops, something went wrong.