refactor(domain): split Icon/WebSub/Counters out of FeedRepository
FeedRepository no longer owns favicons, WebSub subscriber lists or the monitoring counters singleton. Each concern gets its own repository (IconRepository, WebSubSubscriptionRepository, CountersRepository), sharing the key schema via feed-keys. KV key strings are unchanged; counters increment policy stays in utils/stats.ts. Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
1 parent
b347f2f625
commit
a31ff42f59
13 files changed
+204
-119
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { createMockEnv } from "../test/setup";
|
||||
import { WebSubSubscriptionRepository } from "./websub-subscription-repository";
|
||||
import type { Env, WebSubSubscription } from "../types";
|
||||
|
||||
const mockEnv = () => createMockEnv() as unknown as Env;
|
||||
|
||||
describe("WebSubSubscriptionRepository", () => {
|
||||
it("round-trips subscriptions and counts feeds with subscribers", async () => {
|
||||
const repo = new WebSubSubscriptionRepository(mockEnv().EMAIL_STORAGE);
|
||||
expect(await repo.get("a.b.42")).toEqual([]);
|
||||
const subs: WebSubSubscription[] = [
|
||||
{ callbackUrl: "https://r.example/cb", expiresAt: 9999 },
|
||||
];
|
||||
await repo.save("a.b.42", subs);
|
||||
expect(await repo.get("a.b.42")).toEqual(subs);
|
||||
expect(await repo.countKeys()).toBe(1);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user