Fix jwt-token

This commit is contained in:
2025-09-15 06:07:22 +02:00
parent c69f6f6876
commit 861801b35a
2 changed files with 4 additions and 4 deletions

View File

@@ -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 () => {

View File

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