ci: trigga på master + formatfix inför Gitea Actions
CI / Typecheck, test & build (push) Failing after 2s
CI / Typecheck, test & build (push) Failing after 2s
This commit is contained in:
@@ -11,7 +11,10 @@ describe("pushOpsSummaryToEoc", () => {
|
||||
beforeAll(async () => {
|
||||
await redis.set(
|
||||
"ops:summary:cache",
|
||||
JSON.stringify({ app: { app: "cibello", generated_at: new Date().toISOString() }, as_of: new Date().toISOString() }),
|
||||
JSON.stringify({
|
||||
app: { app: "cibello", generated_at: new Date().toISOString() },
|
||||
as_of: new Date().toISOString(),
|
||||
}),
|
||||
"EX",
|
||||
60,
|
||||
);
|
||||
@@ -131,7 +134,9 @@ describe("pushOpsSummaryToEoc", () => {
|
||||
}
|
||||
expect(board.tiles.find((t: { label: string }) => t.label === "MRR")?.tone).toBe("good");
|
||||
expect(board.tiles.find((t: { label: string }) => t.label === "Workers")?.tone).toBe("crit");
|
||||
expect(board.tiles.find((t: { label: string }) => t.label === "Allergen-brott")?.tone).toBe("crit");
|
||||
expect(board.tiles.find((t: { label: string }) => t.label === "Allergen-brott")?.tone).toBe(
|
||||
"crit",
|
||||
);
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
}
|
||||
|
||||
@@ -244,7 +244,13 @@ describe("UPDATE_USER_MEMORY hardening", () => {
|
||||
const aamos = {
|
||||
async runTask() {
|
||||
called = true;
|
||||
return { status: "ok", output: { memoryUpdates: [] }, costUsd: 0, inputTokens: 0, outputTokens: 0 } as AamosResult<"UPDATE_USER_MEMORY">;
|
||||
return {
|
||||
status: "ok",
|
||||
output: { memoryUpdates: [] },
|
||||
costUsd: 0,
|
||||
inputTokens: 0,
|
||||
outputTokens: 0,
|
||||
} as AamosResult<"UPDATE_USER_MEMORY">;
|
||||
},
|
||||
async healthCheck() {
|
||||
return { ok: true };
|
||||
|
||||
@@ -13,10 +13,7 @@ describe.sequential("SEND_PROACTIVE_TIPS", () => {
|
||||
const emailBase = "proactive-tips-test";
|
||||
|
||||
async function cleanup() {
|
||||
const emails = [
|
||||
`${emailBase}-owner@example.invalid`,
|
||||
`${emailBase}-member@example.invalid`,
|
||||
];
|
||||
const emails = [`${emailBase}-owner@example.invalid`, `${emailBase}-member@example.invalid`];
|
||||
const users = await testDb.db
|
||||
.select({ id: schema.users.id })
|
||||
.from(schema.users)
|
||||
@@ -24,7 +21,9 @@ describe.sequential("SEND_PROACTIVE_TIPS", () => {
|
||||
const userIds = users.map((u) => u.id);
|
||||
for (const userId of userIds) {
|
||||
await testDb.db.delete(schema.userConsents).where(eq(schema.userConsents.userId, userId));
|
||||
await testDb.db.delete(schema.householdMembers).where(eq(schema.householdMembers.userId, userId));
|
||||
await testDb.db
|
||||
.delete(schema.householdMembers)
|
||||
.where(eq(schema.householdMembers.userId, userId));
|
||||
await testDb.db.delete(schema.notifications).where(eq(schema.notifications.userId, userId));
|
||||
}
|
||||
const households = await testDb.db
|
||||
@@ -32,20 +31,36 @@ describe.sequential("SEND_PROACTIVE_TIPS", () => {
|
||||
.from(schema.households)
|
||||
.where(eq(schema.households.name, "Proactive Tips Test"));
|
||||
for (const h of households) {
|
||||
await testDb.db.delete(schema.inventoryItems).where(eq(schema.inventoryItems.householdId, h.id));
|
||||
await testDb.db.delete(schema.storageLocations).where(eq(schema.storageLocations.householdId, h.id));
|
||||
await testDb.db
|
||||
.delete(schema.inventoryItems)
|
||||
.where(eq(schema.inventoryItems.householdId, h.id));
|
||||
await testDb.db
|
||||
.delete(schema.storageLocations)
|
||||
.where(eq(schema.storageLocations.householdId, h.id));
|
||||
await testDb.db.delete(schema.households).where(eq(schema.households.id, h.id));
|
||||
}
|
||||
for (const email of emails) {
|
||||
await testDb.db.delete(schema.users).where(eq(schema.users.email, email));
|
||||
}
|
||||
// Clean up test recipes/ingredients if exists.
|
||||
await testDb.db.delete(schema.recipeIngredients).where(eq(schema.recipeIngredients.recipeId, "00000000-0000-0000-0000-000000000abc"));
|
||||
await testDb.db.delete(schema.recipeIngredients).where(eq(schema.recipeIngredients.recipeId, "00000000-0000-0000-0000-000000000def"));
|
||||
await testDb.db.delete(schema.recipes).where(eq(schema.recipes.id, "00000000-0000-0000-0000-000000000abc"));
|
||||
await testDb.db.delete(schema.recipes).where(eq(schema.recipes.id, "00000000-0000-0000-0000-000000000def"));
|
||||
await testDb.db.delete(schema.canonicalIngredients).where(eq(schema.canonicalIngredients.id, "test_cucumber_001"));
|
||||
await testDb.db.delete(schema.canonicalIngredients).where(eq(schema.canonicalIngredients.id, "test_tomato_001"));
|
||||
await testDb.db
|
||||
.delete(schema.recipeIngredients)
|
||||
.where(eq(schema.recipeIngredients.recipeId, "00000000-0000-0000-0000-000000000abc"));
|
||||
await testDb.db
|
||||
.delete(schema.recipeIngredients)
|
||||
.where(eq(schema.recipeIngredients.recipeId, "00000000-0000-0000-0000-000000000def"));
|
||||
await testDb.db
|
||||
.delete(schema.recipes)
|
||||
.where(eq(schema.recipes.id, "00000000-0000-0000-0000-000000000abc"));
|
||||
await testDb.db
|
||||
.delete(schema.recipes)
|
||||
.where(eq(schema.recipes.id, "00000000-0000-0000-0000-000000000def"));
|
||||
await testDb.db
|
||||
.delete(schema.canonicalIngredients)
|
||||
.where(eq(schema.canonicalIngredients.id, "test_cucumber_001"));
|
||||
await testDb.db
|
||||
.delete(schema.canonicalIngredients)
|
||||
.where(eq(schema.canonicalIngredients.id, "test_tomato_001"));
|
||||
}
|
||||
|
||||
async function setup() {
|
||||
@@ -68,7 +83,12 @@ describe.sequential("SEND_PROACTIVE_TIPS", () => {
|
||||
|
||||
const [household] = await testDb.db
|
||||
.insert(schema.households)
|
||||
.values({ name: "Proactive Tips Test", size: 2, locale: "sv-SE", inviteCode: "PROACTIVETEST" })
|
||||
.values({
|
||||
name: "Proactive Tips Test",
|
||||
size: 2,
|
||||
locale: "sv-SE",
|
||||
inviteCode: "PROACTIVETEST",
|
||||
})
|
||||
.returning();
|
||||
|
||||
await testDb.db.insert(schema.householdMembers).values([
|
||||
@@ -236,7 +256,9 @@ describe.sequential("SEND_PROACTIVE_TIPS", () => {
|
||||
await testDb.db
|
||||
.update(schema.userConsents)
|
||||
.set({ status: "revoked" })
|
||||
.where(and(eq(schema.userConsents.userId, ownerId), eq(schema.userConsents.kind, "notifications")));
|
||||
.where(
|
||||
and(eq(schema.userConsents.userId, ownerId), eq(schema.userConsents.kind, "notifications")),
|
||||
);
|
||||
|
||||
// Rensa notisen för att simulera ny dag.
|
||||
await testDb.db.delete(schema.notifications).where(eq(schema.notifications.userId, ownerId));
|
||||
|
||||
@@ -8,5 +8,6 @@ process.env.EMAIL_MODE = "log";
|
||||
process.env.S3_MODE = "mock";
|
||||
process.env.LOG_LEVEL = "error";
|
||||
|
||||
process.env.TEST_DATABASE_URL ||= "postgres://app_user:app_dev_password@localhost:5432/cibello_test";
|
||||
process.env.TEST_DATABASE_URL ||=
|
||||
"postgres://app_user:app_dev_password@localhost:5432/cibello_test";
|
||||
process.env.DATABASE_URL = process.env.TEST_DATABASE_URL;
|
||||
|
||||
@@ -9,7 +9,10 @@ describe("BUILD_TRAINING_SAMPLE banks locally", () => {
|
||||
const email = "training-export-test@example.invalid";
|
||||
|
||||
async function cleanup() {
|
||||
const existing = await testDb.db.select({ id: schema.users.id }).from(schema.users).where(eq(schema.users.email, email));
|
||||
const existing = await testDb.db
|
||||
.select({ id: schema.users.id })
|
||||
.from(schema.users)
|
||||
.where(eq(schema.users.email, email));
|
||||
for (const u of existing) {
|
||||
await testDb.db.delete(schema.aiCorrections).where(eq(schema.aiCorrections.userId, u.id));
|
||||
await testDb.db.delete(schema.userConsents).where(eq(schema.userConsents.userId, u.id));
|
||||
@@ -63,7 +66,10 @@ describe("BUILD_TRAINING_SAMPLE banks locally", () => {
|
||||
taskType: "ANALYZE_FRIDGE_IMAGE",
|
||||
aiOutput: { raw: { items: [] } },
|
||||
proposal: { detectedName: "Mellanmjölk", confidence: 0.98 },
|
||||
userCorrection: { action: "accept", corrected: { displayName: "Mellanmjölk", quantity: 1, unit: "LITER" } },
|
||||
userCorrection: {
|
||||
action: "accept",
|
||||
corrected: { displayName: "Mellanmjölk", quantity: 1, unit: "LITER" },
|
||||
},
|
||||
imageS3Key: "fridge-scans/train.jpg",
|
||||
modelVersion: "gemini-2.5-flash",
|
||||
promptVersion: "gemini-fridge-v1",
|
||||
|
||||
Reference in New Issue
Block a user