Fix tasks
This commit is contained in:
parent
70a560724d
commit
7b9be6da84
3 changed files with 9 additions and 22 deletions
|
|
@ -14,7 +14,7 @@ steps:
|
|||
- '--region'
|
||||
- 'europe-west1'
|
||||
- '--set-env-vars'
|
||||
- 'NODE_ENV=$_NODE_ENV,SUPABASE_URL=$_SUPABASE_URL,STREAM_CHAT_API_KEY=$_STREAM_CHAT_API_KEY,EMAIL_USER=$_EMAIL_USER,EMAIL_CLIENT_ID=$_EMAIL_CLIENT_ID,R2_ACCOUNT_ID=$_R2_ACCOUNT_ID,CORS_ORIGIN=$_CORS_ORIGIN,XTABLO_URL=$_XTABLO_URL,LOG_LEVEL=$_LOG_LEVEL'
|
||||
- 'NODE_ENV=$_NODE_ENV,SUPABASE_URL=$_SUPABASE_URL,STREAM_CHAT_API_KEY=$_STREAM_CHAT_API_KEY,EMAIL_USER=$_EMAIL_USER,EMAIL_CLIENT_ID=$_EMAIL_CLIENT_ID,R2_ACCOUNT_ID=$_R2_ACCOUNT_ID,CORS_ORIGIN=$_CORS_ORIGIN,XTABLO_URL=$_XTABLO_URL,TASKS_SECRET=$_TASKS_SECRET,LOG_LEVEL=$_LOG_LEVEL'
|
||||
images:
|
||||
- 'europe-west1-docker.pkg.dev/$_AR_PROJECT_ID/$_AR_REPOSITORY/xtablo-source/$_SERVICE_NAME:$COMMIT_SHA'
|
||||
|
||||
|
|
|
|||
|
|
@ -61,14 +61,9 @@ describe("Tasks Endpoint", () => {
|
|||
}
|
||||
);
|
||||
|
||||
// In test environment, TASKS_SECRET may not be properly configured
|
||||
// So we accept either 200 (success) or 401 (auth mismatch)
|
||||
expect([200, 401]).toContain(res.status);
|
||||
|
||||
if (res.status === 200) {
|
||||
const data = await res.json();
|
||||
expect(data.message).toBe("Synced calendars");
|
||||
}
|
||||
expect(res.status).toBe(200);
|
||||
const data = await res.json();
|
||||
expect(data.message).toBe("Synced calendars");
|
||||
});
|
||||
|
||||
it("should deny sync calendars without auth header", async () => {
|
||||
|
|
@ -123,19 +118,11 @@ describe("Tasks Endpoint", () => {
|
|||
}
|
||||
);
|
||||
|
||||
// In test environment, TASKS_SECRET may not be properly configured
|
||||
// So we accept either 200 (success) or 401 (auth mismatch)
|
||||
expect([200, 401]).toContain(res.status);
|
||||
expect(res.status).toBe(200);
|
||||
|
||||
if (res.status === 200) {
|
||||
const data = await res.json();
|
||||
expect(data.message).toContain("Synced");
|
||||
expect(data.message).toContain("tablo names");
|
||||
|
||||
// Note: Stream Chat channel update is only called for tablos updated in the last 15 minutes
|
||||
// In test environment, this may be 0 if test data wasn't recently created
|
||||
// The mock is set up to handle the calls if they occur
|
||||
}
|
||||
const data = await res.json();
|
||||
expect(data.message).toContain("Synced");
|
||||
expect(data.message).toContain("tablo names");
|
||||
});
|
||||
|
||||
it("should deny sync tablo names without auth header", async () => {
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ export class MiddlewareManager {
|
|||
|
||||
const basicAuthMiddleware = createMiddleware(async (c: Context, next: Next) => {
|
||||
if (config.TASKS_SECRET === "") {
|
||||
return c.json({ error: "Unauthorized" }, 401);
|
||||
return c.json({ error: "Unauthorized: TASKS_SECRET is not set" }, 401);
|
||||
}
|
||||
const authHeader = c.req.header("Authorization");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue