test(script-deployer): fix failing test due to non-refreshed cache

This commit is contained in:
Elian Doran
2026-04-23 20:48:44 +03:00
parent 7cf5e7f1d9
commit 0077b35854
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -21,6 +21,7 @@ vi.mock("@triliumnext/server/src/services/sql", () => ({
execute: () => {},
replace: () => {},
getMap: () => {},
getValue: () => null,
},
}));
+4
View File
@@ -136,6 +136,7 @@ export interface BeccaLike {
setContent(content: string): void;
setRelation(name: string, targetNoteId: string): void;
setLabel(name: string, value?: string): void;
invalidateThisCache(): void;
}>;
}
@@ -157,6 +158,9 @@ function applyLabels(note: BeccaLike["notes"][string], meta: ScriptMeta) {
note.setLabel(label, meta[label]);
}
}
// BNote caches attributes eagerly during setLabel's save() path.
// Invalidate so subsequent reads see all labels we just set.
note.invalidateThisCache();
}
/**