mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-09-23 19:17:07 +00:00
Align host integrations with current API recommendations
This commit is contained in:
@@ -35,7 +35,7 @@ export class LocalDatabaseMaintenance extends LiveSyncCommands {
|
||||
}
|
||||
onload(): void | Promise<void> {
|
||||
// NO OP.
|
||||
this.plugin.addCommand({
|
||||
this.services.API.addCommand({
|
||||
id: "analyse-database",
|
||||
name: "Analyse Database Usage (advanced)",
|
||||
icon: "database-search",
|
||||
@@ -47,7 +47,7 @@ export class LocalDatabaseMaintenance extends LiveSyncCommands {
|
||||
return true;
|
||||
},
|
||||
});
|
||||
this.plugin.addCommand({
|
||||
this.services.API.addCommand({
|
||||
id: "gc-v3",
|
||||
name: "Garbage Collection V3 (advanced, beta)",
|
||||
icon: "trash-2",
|
||||
|
||||
@@ -18,10 +18,13 @@ vi.mock("@vrtmrz/livesync-commonlib/compat/common/utils", async (importOriginal)
|
||||
});
|
||||
vi.mock("@/features/LiveSyncCommands", () => ({
|
||||
LiveSyncCommands: class LiveSyncCommands {
|
||||
core!: { settings: unknown };
|
||||
core!: { settings: unknown; services: unknown };
|
||||
get settings() {
|
||||
return this.core.settings;
|
||||
}
|
||||
get services() {
|
||||
return this.core.services;
|
||||
}
|
||||
},
|
||||
}));
|
||||
vi.mock("@/common/events", () => ({
|
||||
@@ -76,11 +79,13 @@ describe("LocalDatabaseMaintenance prerequisites", () => {
|
||||
};
|
||||
const maintenance = Object.create(LocalDatabaseMaintenance.prototype) as LocalDatabaseMaintenance;
|
||||
Object.assign(maintenance, {
|
||||
plugin: {
|
||||
addCommand: vi.fn((command) => commands.push(command)),
|
||||
},
|
||||
core: {
|
||||
settings,
|
||||
services: {
|
||||
API: {
|
||||
addCommand: vi.fn((command) => commands.push(command)),
|
||||
},
|
||||
},
|
||||
},
|
||||
_isDatabaseReady: vi.fn(() => true),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user