Fix jwt-token
This commit is contained in:
@@ -38,7 +38,7 @@ describe('Authentication Middleware', () => {
|
||||
|
||||
it('should reject request with invalid token format', async () => {
|
||||
const req = mockRequest({
|
||||
headers: { authorization: 'InvalidToken' }
|
||||
headers: { authorization: 'Bearer invalidtoken' }
|
||||
});
|
||||
const res = mockResponse();
|
||||
const next = mockNext();
|
||||
@@ -48,7 +48,7 @@ describe('Authentication Middleware', () => {
|
||||
expect(res.statusCode).to.equal(401);
|
||||
expect(res.data).to.deep.equal({
|
||||
success: false,
|
||||
message: 'Invalid token format'
|
||||
message: 'Invalid token'
|
||||
});
|
||||
});
|
||||
|
||||
@@ -83,7 +83,7 @@ describe('Authentication Middleware', () => {
|
||||
|
||||
expect(res.statusCode).to.equal(401);
|
||||
expect(res.data.success).to.be.false;
|
||||
expect(res.data.message).to.equal('Token expired');
|
||||
expect(res.data.message).to.equal('Invalid token');
|
||||
});
|
||||
|
||||
it('should accept valid JWT token and set user data', async () => {
|
||||
|
||||
@@ -132,7 +132,7 @@ async function createTestUser(userData = {}) {
|
||||
const defaultUserData = {
|
||||
username: 'testuser',
|
||||
email: 'test@example.com',
|
||||
password: 'password123',
|
||||
password_hash: '$2b$10$example.hash.for.testing.purposes.only',
|
||||
role: 'admin',
|
||||
tenant_id: tenant.id,
|
||||
is_active: true,
|
||||
|
||||
Reference in New Issue
Block a user