Fix jwt-token
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
const { describe, it, beforeEach, afterEach, before, after } = require('mocha');
|
||||
const { expect } = require('chai');
|
||||
const sinon = require('sinon');
|
||||
co const token = jwt.sign(
|
||||
{
|
||||
userId: user.id, // Use the UUID directly
|
||||
username: user.username,
|
||||
role: user.role,
|
||||
tenantId: 'test-tenant'
|
||||
},
|
||||
process.env.JWT_SECRET || 'test-secret',
|
||||
{ expiresIn: '1h' }
|
||||
);= require('sinon');
|
||||
const jwt = require('jsonwebtoken');
|
||||
const { authenticateToken } = require('../../middleware/auth');
|
||||
const { setupTestEnvironment, teardownTestEnvironment, cleanDatabase, mockRequest, mockResponse, mockNext, createTestUser, createTestTenant } = require('../setup');
|
||||
@@ -92,7 +101,7 @@ describe('Authentication Middleware', () => {
|
||||
|
||||
const token = jwt.sign(
|
||||
{
|
||||
userId: user.id.toString(), // Convert UUID to string
|
||||
userId: user.id, // Use the UUID directly
|
||||
username: user.username,
|
||||
role: user.role,
|
||||
email: user.email
|
||||
|
||||
Reference in New Issue
Block a user