From caac0e59cdf2efccfaa4fd83a6fb9940464437b9 Mon Sep 17 00:00:00 2001 From: Alexander Borg Date: Mon, 15 Sep 2025 10:21:49 +0200 Subject: [PATCH] Fix jwt-token --- server/tests/setup.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/server/tests/setup.js b/server/tests/setup.js index 475fab6..f80071b 100644 --- a/server/tests/setup.js +++ b/server/tests/setup.js @@ -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