Remove unused test context code

This commit is contained in:
Adria Navarro 2023-12-01 09:36:24 +01:00
parent fcb862c82f
commit fe0efc7539
1 changed files with 28 additions and 11 deletions

View File

@ -145,23 +145,19 @@ export async function doInTenant<T>(
}
export async function doInAppContext<T>(
appId: string | null,
appId: string,
task: () => T
): Promise<T> {
if (!appId && !env.isTest()) {
if (!appId) {
throw new Error("appId is required")
}
let updates: ContextMap
if (!appId) {
updates = { appId: "" }
} else {
const tenantId = getTenantIDFromAppID(appId)
updates = { appId }
if (tenantId) {
updates.tenantId = tenantId
}
const tenantId = getTenantIDFromAppID(appId)
const updates: ContextMap = { appId }
if (tenantId) {
updates.tenantId = tenantId
}
return newContext(updates, task)
}
@ -182,6 +178,27 @@ export async function doInIdentityContext<T>(
return newContext(context, task)
}
export async function doInAppMigrationContext<T>(
appId: string,
task: () => T
): Promise<T> {
if (!appId && !env.isTest()) {
throw new Error("appId is required")
}
let updates: ContextMap
if (!appId) {
updates = { appId: "" }
} else {
const tenantId = getTenantIDFromAppID(appId)
updates = { appId }
if (tenantId) {
updates.tenantId = tenantId
}
}
return newContext(updates, task)
}
export function getIdentity(): IdentityContext | undefined {
try {
const context = Context.get()