Fix jwt-token
This commit is contained in:
@@ -121,12 +121,18 @@ async function createTestUser(userData = {}) {
|
||||
// Create default tenant if not exists
|
||||
let tenant = await Tenant.findOne({ where: { slug: 'test-tenant' } });
|
||||
if (!tenant) {
|
||||
try {
|
||||
tenant = await Tenant.create({
|
||||
name: 'Test Tenant',
|
||||
slug: 'test-tenant',
|
||||
domain: 'test.example.com',
|
||||
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
|
||||
@@ -222,7 +228,14 @@ async function createTestTenant(tenantData = {}) {
|
||||
...tenantData
|
||||
};
|
||||
|
||||
try {
|
||||
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