mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-01 18:22:41 -08:00
feat: add manual known-word cache refresh path
- Add CLI command flag with non-GUI dispatch flow and OSD error handling. - Add runtime integration call and IPC hook so manual refresh works from command runner without app startup. - Add public AnkiIntegration manual refresh API with force refresh semantics and guard reuse. - Preserve default n+1 behavior by fixing config validation for malformed values and adding tests.
This commit is contained in:
@@ -107,6 +107,7 @@ test("registerAnkiJimakuIpcRuntimeService provides full handler surface", () =>
|
||||
const expected = [
|
||||
"setAnkiConnectEnabled",
|
||||
"clearAnkiHistory",
|
||||
"refreshKnownWords",
|
||||
"respondFieldGrouping",
|
||||
"buildKikuMergePreview",
|
||||
"getJimakuMediaInfo",
|
||||
@@ -124,6 +125,31 @@ test("registerAnkiJimakuIpcRuntimeService provides full handler surface", () =>
|
||||
}
|
||||
});
|
||||
|
||||
test("refreshKnownWords throws when integration is unavailable", async () => {
|
||||
const { registered } = createHarness();
|
||||
|
||||
await assert.rejects(
|
||||
async () => {
|
||||
await registered.refreshKnownWords();
|
||||
},
|
||||
{ message: "AnkiConnect integration not enabled" },
|
||||
);
|
||||
});
|
||||
|
||||
test("refreshKnownWords delegates to integration", async () => {
|
||||
const { registered, state } = createHarness();
|
||||
let refreshed = 0;
|
||||
state.ankiIntegration = {
|
||||
refreshKnownWordCache: async () => {
|
||||
refreshed += 1;
|
||||
},
|
||||
};
|
||||
|
||||
await registered.refreshKnownWords();
|
||||
|
||||
assert.equal(refreshed, 1);
|
||||
});
|
||||
|
||||
test("setAnkiConnectEnabled disables active integration and broadcasts changes", () => {
|
||||
const { registered, state } = createHarness();
|
||||
let destroyed = 0;
|
||||
|
||||
Reference in New Issue
Block a user