


























@@ -170,12 +170,12 @@ describe("discord component registry", () => {
170170modals: [],
171171});
172172173-expect(second.resolveDiscordComponentEntry({ id: "btn_shared", consume: false })).toMatchObject(
174- {
175- id: "btn_shared",
176- label: "Shared",
177- },
178-);
173+const sharedEntry = second.resolveDiscordComponentEntry({ id: "btn_shared", consume: false });
174+expect(sharedEntry?.id).toBe("btn_shared");
175+expect(sharedEntry?.kind).toBe("button");
176+expect(sharedEntry?.label).toBe("Shared");
177+expect(typeof sharedEntry?.createdAt).toBe("number");
178+expect(typeof sharedEntry?.expiresAt).toBe("number");
179179180180second.clearDiscordComponentEntries();
181181});
@@ -261,10 +261,10 @@ describe("discord component registry", () => {
261261clearDiscordComponentEntries();
262262await expect(
263263resolveDiscordComponentEntryWithPersistence({ id: "btn_persisted", consume: false }),
264-).resolves.toMatchObject({ id: "btn_persisted" });
264+).resolves.toStrictEqual({ id: "btn_persisted", kind: "button", label: "Persisted" });
265265await expect(
266266resolveDiscordModalEntryWithPersistence({ id: "mdl_persisted", consume: false }),
267-).resolves.toMatchObject({ id: "mdl_persisted" });
267+).resolves.toStrictEqual({ id: "mdl_persisted", title: "Persisted", fields: [] });
268268expect(componentLookup).toHaveBeenCalledWith("btn_persisted");
269269expect(modalLookup).toHaveBeenCalledWith("mdl_persisted");
270270expect(openKeyedStore).toHaveBeenCalledTimes(4);
@@ -305,8 +305,12 @@ describe("discord component registry", () => {
305305clearDiscordComponentEntries();
306306await expect(
307307resolveDiscordComponentEntryWithPersistence({ id: "btn_confirm" }),
308-).resolves.toMatchObject({
308+).resolves.toStrictEqual({
309309id: "btn_confirm",
310+kind: "button",
311+label: "Confirm",
312+consumptionGroupId: "grp_1",
313+consumptionGroupEntryIds: ["btn_confirm", "btn_cancel"],
310314});
311315312316await vi.waitFor(() => expect(componentDelete).toHaveBeenCalledWith("btn_cancel"));
@@ -330,10 +334,12 @@ describe("discord component registry", () => {
330334modals: [],
331335});
332336333-expect(resolveDiscordComponentEntry({ id: "btn_fallback", consume: false })).toMatchObject({
334-id: "btn_fallback",
335-label: "Fallback",
336-});
337+const fallbackEntry = resolveDiscordComponentEntry({ id: "btn_fallback", consume: false });
338+expect(fallbackEntry?.id).toBe("btn_fallback");
339+expect(fallbackEntry?.kind).toBe("button");
340+expect(fallbackEntry?.label).toBe("Fallback");
341+expect(typeof fallbackEntry?.createdAt).toBe("number");
342+expect(typeof fallbackEntry?.expiresAt).toBe("number");
337343expect(warn).toHaveBeenCalled();
338344});
339345});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。