



























@@ -28,6 +28,14 @@ function makeProvider(id: string, label?: string): CompactionProvider {
2828};
2929}
303031+function requireCompactionProvider(id: string): CompactionProvider {
32+const provider = getCompactionProvider(id);
33+if (!provider) {
34+throw new Error(`Expected compaction provider ${id}`);
35+}
36+return provider;
37+}
38+3139describe("compaction provider registry", () => {
3240it("starts empty", () => {
3341expect(listCompactionProviderIds()).toEqual([]);
@@ -88,8 +96,8 @@ describe("compaction provider registry", () => {
8896it("calls summarize and returns expected result", async () => {
8997registerCompactionProvider(makeProvider("my-compactor"));
909891-const provider = getCompactionProvider("my-compactor");
92-const result = await provider!.summarize({ messages: [] });
99+const provider = requireCompactionProvider("my-compactor");
100+const result = await provider.summarize({ messages: [] });
9310194102expect(result).toBe("summary-from-my-compactor");
95103});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。