diigo-cache: public list shows each bookmark's date first
The list is in diigo's updated order; each item now leads with its updated_at as Date#toISOString() (diigo sends epoch seconds; updatedISO converts, tested), or "(no date)". Generated-by: Claude Opus 5.5
This commit is contained in:
1 parent
80c9279825
commit
860bbee2b5
4 files changed
+26
-3
No files matched your search
@@ -117,6 +117,8 @@ describe("worker routes", () => {
|
||||
const again = await (await call(`/public/${username}?page=2`)).text();
|
||||
expect(again).toContain("<strong>cache: HIT");
|
||||
expect(html).toContain("bookmark 25");
|
||||
// the date comes first, in toISOString() form
|
||||
expect(html).toMatch(/<li><time datetime="\d{4}-\d\d-\d\dT[\d:.]+Z">[^<]+<\/time> <a /);
|
||||
expect(html).not.toContain("bookmark 27"); // private (27 % 3 === 0)
|
||||
|
||||
const json = (await (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { publicOnly, toRows, usernameOf } from "../src/items.js";
|
||||
import { publicOnly, toRows, updatedISO, usernameOf } from "../src/items.js";
|
||||
import type { Item } from "../src/items.js";
|
||||
|
||||
/** a load_user_items row: diigo's actual field names (observed
|
||||
@@ -70,3 +70,14 @@ describe("publicOnly", () => {
|
||||
expect(JSON.stringify(rows)).not.toContain("secret.example");
|
||||
});
|
||||
});
|
||||
|
||||
describe("updatedISO", () => {
|
||||
it("reads diigo's updated_at as epoch seconds", () => {
|
||||
expect(updatedISO({ updated_at: 1700000000 })).toBe("2023-11-14T22:13:20.000Z");
|
||||
});
|
||||
|
||||
it("answers empty when there is no usable date", () => {
|
||||
expect(updatedISO({})).toBe("");
|
||||
expect(updatedISO({ updated_at: "yesterday" })).toBe("");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user