Fix jwt-token
This commit is contained in:
@@ -121,12 +121,18 @@ async function createTestUser(userData = {}) {
|
|||||||
// Create default tenant if not exists
|
// Create default tenant if not exists
|
||||||
let tenant = await Tenant.findOne({ where: { slug: 'test-tenant' } });
|
let tenant = await Tenant.findOne({ where: { slug: 'test-tenant' } });
|
||||||
if (!tenant) {
|
if (!tenant) {
|
||||||
|
try {
|
||||||
tenant = await Tenant.create({
|
tenant = await Tenant.create({
|
||||||
name: 'Test Tenant',
|
name: 'Test Tenant',
|
||||||
slug: 'test-tenant',
|
slug: 'test-tenant',
|
||||||
domain: 'test.example.com',
|
domain: 'test.example.com',
|
||||||
is_active: true
|
is_active: true
|
||||||
});
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ Default tenant creation failed:', error.message);
|
||||||
|
console.error('❌ Validation errors:', error.errors);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate a unique username to avoid conflicts
|
// Generate a unique username to avoid conflicts
|
||||||
@@ -222,7 +228,14 @@ async function createTestTenant(tenantData = {}) {
|
|||||||
...tenantData
|
...tenantData
|
||||||
};
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
return await Tenant.create(defaultTenantData);
|
return await Tenant.create(defaultTenantData);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ Tenant creation failed:', error.message);
|
||||||
|
console.error('❌ Validation errors:', error.errors);
|
||||||
|
console.error('❌ Tenant data:', defaultTenantData);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user