mirror of
https://github.com/Patiun/com.gregkilmer.www.git
synced 2026-11-08 04:08:24 +00:00
Homebox sync: fall back to tags when /labels is gone
Newer Homebox releases renamed labels to tags (/api/v1/tags and the items?tags= filter), so the labels call answered 404. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012aSbo2D1qP8cMFQCykf7kx
This commit is contained in:
@@ -375,6 +375,32 @@ describe("Homebox", () => {
|
||||
const missing = await scheduler(homeboxJob({ url: "http://homebox:7745", user: "u", pass: "p", labels: parseFilters("vinyl") }), f.fn).runNow("homebox");
|
||||
expect(missing).toMatchObject({ ok: false, message: expect.stringContaining("vinyl") });
|
||||
});
|
||||
|
||||
it("falls back to tags on Homebox releases without /labels", async () => {
|
||||
r.put({
|
||||
type: "product-line",
|
||||
title: "Wallet",
|
||||
category: "Leather",
|
||||
mode: "made to order",
|
||||
channel: "here",
|
||||
summary: "s",
|
||||
slots: { open: 1, total: 2 },
|
||||
priceTiers: [],
|
||||
options: [{ group: "Leather", name: "Chrome tan, Black" }],
|
||||
publish: true,
|
||||
});
|
||||
r.service.scan();
|
||||
const f = fakeFetch((url) => {
|
||||
if (url.endsWith("/api/v1/users/login")) return ok({ token: "Bearer hb-token", expiresAt: "2026-10-12T00:00:00Z" });
|
||||
if (url.endsWith("/api/v1/tags")) return ok(fixture("homebox-labels.sample.json"));
|
||||
if (url.includes("/api/v1/items?")) {
|
||||
return new URL(url).searchParams.get("tags")?.endsWith("01") ? ok(fixture("homebox-items.sample.json")) : ok({ items: [], total: 0 });
|
||||
}
|
||||
return ok({}, 404);
|
||||
});
|
||||
const report = await scheduler(homeboxJob({ url: "http://homebox:7745", user: "u", pass: "p", labels: parseFilters("leather,paper") }), f.fn).runNow("homebox");
|
||||
expect(report).toMatchObject({ ok: true, counts: { lines: 1, leather: 1, paper: 0 } });
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------- settings
|
||||
|
||||
Reference in New Issue
Block a user