




















@@ -50,14 +50,25 @@ describe("normalizeRegisteredChannelPlugin", () => {
5050});
51515252const telegram = getChatChannelMeta("telegram");
53-expect(normalized?.meta).toMatchObject({
53+expect({
54+label: normalized?.meta.label,
55+selectionLabel: normalized?.meta.selectionLabel,
56+docsPath: normalized?.meta.docsPath,
57+blurb: normalized?.meta.blurb,
58+}).toEqual({
5459label: telegram.label,
5560selectionLabel: telegram.selectionLabel,
5661docsPath: telegram.docsPath,
5762blurb: telegram.blurb,
5863});
59-expect(diagnostics.map((diag) => diag.message)).toEqual([
60-'channel "telegram" registered incomplete metadata; filled missing label, selectionLabel, docsPath, blurb',
64+expect(diagnostics).toEqual([
65+{
66+level: "warn",
67+pluginId: "demo-plugin",
68+source: "/tmp/demo/index.ts",
69+message:
70+'channel "telegram" registered incomplete metadata; filled missing label, selectionLabel, docsPath, blurb',
71+},
6172]);
6273});
6374@@ -77,15 +88,21 @@ describe("normalizeRegisteredChannelPlugin", () => {
7788});
78897990expect(normalized?.id).toBe("external-chat");
80-expect(normalized?.meta).toMatchObject({
91+expect(normalized?.meta).toEqual({
8192id: "external-chat",
8293label: "external-chat",
8394selectionLabel: "external-chat",
8495docsPath: "/channels/external-chat",
8596blurb: "",
8697});
87-expect(diagnostics.map((diag) => diag.message)).toEqual([
88-'channel "external-chat" registered incomplete metadata; filled missing label, selectionLabel, docsPath, blurb',
98+expect(diagnostics).toEqual([
99+{
100+level: "warn",
101+pluginId: "demo-plugin",
102+source: "/tmp/demo/index.ts",
103+message:
104+'channel "external-chat" registered incomplete metadata; filled missing label, selectionLabel, docsPath, blurb',
105+},
89106]);
90107});
91108@@ -110,8 +127,13 @@ describe("normalizeRegisteredChannelPlugin", () => {
110127111128expect(normalized?.id).toBe("demo");
112129expect(normalized?.meta.id).toBe("demo");
113-expect(diagnostics.map((diag) => diag.message)).toEqual([
114-'channel "demo" meta.id mismatch ("other-demo"); using registered channel id',
130+expect(diagnostics).toEqual([
131+{
132+level: "warn",
133+pluginId: "demo-plugin",
134+source: "/tmp/demo/index.ts",
135+message: 'channel "demo" meta.id mismatch ("other-demo"); using registered channel id',
136+},
115137]);
116138});
117139@@ -130,10 +152,12 @@ describe("normalizeRegisteredChannelPlugin", () => {
130152131153expect(normalized).toBeNull();
132154expect(diagnostics).toEqual([
133-expect.objectContaining({
155+{
134156level: "error",
157+pluginId: "demo-plugin",
158+source: "/tmp/demo/index.ts",
135159message: 'channel "broken-channel" registration missing required config helpers',
136-}),
160+},
137161]);
138162});
139163});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。