Fix jwt-token

This commit is contained in:
2025-09-15 10:21:49 +02:00
parent c099715540
commit caac0e59cd

View File

@@ -129,13 +129,12 @@ async function createTestUser(userData = {}) {
});
}
// Generate a simple UUID-like string for testing
const testId = 'test-' + Date.now() + '-' + Math.random().toString(36).substr(2, 9);
// Generate a unique username to avoid conflicts
const uniqueSuffix = Date.now() + '-' + Math.random().toString(36).substr(2, 5);
const defaultUserData = {
id: testId, // Use explicit test ID
username: 'testuser',
email: 'test@example.com',
username: userData.username || 'testuser-' + uniqueSuffix,
email: userData.email || 'test-' + uniqueSuffix + '@example.com',
password_hash: '$2b$10$example.hash.for.testing.purposes.only',
role: 'admin',
tenant_id: tenant.id,
@@ -215,13 +214,9 @@ async function createTestDetection(detectionData = {}) {
async function createTestTenant(tenantData = {}) {
const { Tenant } = models;
// Generate a simple test ID for tenant
const testId = 'tenant-' + Date.now() + '-' + Math.random().toString(36).substr(2, 9);
const defaultTenantData = {
id: testId, // Use explicit test ID
name: 'Test Tenant',
slug: 'test-tenant-' + Date.now(),
slug: 'test-tenant-' + Date.now() + '-' + Math.random().toString(36).substr(2, 5),
domain: 'test.example.com',
is_active: true,
...tenantData