Fix jwt-token

This commit is contained in:
2025-09-16 07:56:56 +02:00
parent eb446809bb
commit b3ada7ccfe
2 changed files with 44 additions and 3 deletions

View File

@@ -0,0 +1,38 @@
/**
* Test Domain Utilities
* Standardizes fake domain usage across all tests for multi-tenant scenarios
*/
/**
* Generate a fake domain for a tenant slug
* @param {string} tenantSlug - The tenant slug (e.g., 'test-tenant')
* @returns {string} - The fake domain (e.g., 'test-tenant.example.com')
*/
function getTenantDomain(tenantSlug) {
return `${tenantSlug}.example.com`;
}
/**
* Create a supertest request with proper tenant domain
* @param {Object} app - Express app instance
* @param {string} tenantSlug - The tenant slug
* @returns {Object} - Request object with Host header set
*/
function createTenantRequest(request, app, tenantSlug) {
return request(app).set('Host', getTenantDomain(tenantSlug));
}
/**
* Standard test tenant configurations
*/
const TEST_TENANTS = {
DEFAULT: 'test-tenant',
SECONDARY: 'test-tenant-2',
ADMIN: 'admin-tenant'
};
module.exports = {
getTenantDomain,
createTenantRequest,
TEST_TENANTS
};