Add test case for integration import task handler

This commit is contained in:
Hongbo Wu
2023-03-01 23:15:03 +08:00
parent d8b2d5476b
commit 10c01c12f2
7 changed files with 163 additions and 103 deletions

View File

@ -443,14 +443,17 @@ export const enqueueRecommendation = async (
export const enqueueImportFromIntegration = async (
userId: string,
integrationId: string
integrationId: string,
authToken: string
): Promise<string> => {
const { GOOGLE_CLOUD_PROJECT } = process.env
const payload = {
userId,
integrationId,
}
const headers = {
Cookie: `auth=${authToken}`,
}
// If there is no Google Cloud Project Id exposed, it means that we are in local environment
if (env.dev.isLocal || !GOOGLE_CLOUD_PROJECT) {
return nanoid()
@ -461,6 +464,7 @@ export const enqueueImportFromIntegration = async (
payload,
taskHandlerUrl: `${env.queue.integrationTaskHandlerUrl}/import`,
priority: 'low',
requestHeaders: headers,
})
if (!createdTasks || !createdTasks[0].name) {