diff --git a/src/components/ContactListItem.vue b/src/components/ContactListItem.vue index c972fe80..4e17d700 100644 --- a/src/components/ContactListItem.vue +++ b/src/components/ContactListItem.vue @@ -158,7 +158,7 @@ export default class ContactListItem extends Vue { @Emit("open-offer-dialog") emitOpenOfferDialog(did: string, name: string | undefined) { - return { did, name }; + return [did, name]; } /** diff --git a/src/test/ContactListItem.test.ts b/src/test/ContactListItem.test.ts index c951081f..773a6fc0 100644 --- a/src/test/ContactListItem.test.ts +++ b/src/test/ContactListItem.test.ts @@ -168,17 +168,18 @@ describe("ContactListItem", () => { }); it("should emit open-offer-dialog event when offer button is clicked", () => { + const contact = createStandardMockContact({ did: "did:ethr:test:other" }); wrapper = mountComponent({ showActions: true, - contact: createStandardMockContact({ did: "did:ethr:test:other" }), + contact, }); wrapper.find('[data-testid="offerButton"]').trigger("click"); expect(wrapper.emitted("open-offer-dialog")).toBeTruthy(); - expect(wrapper.emitted("open-offer-dialog")[0][0]).toBe( - "did:ethr:test:other", - ); + // Test that both parameters are emitted correctly + const emittedData = wrapper.emitted("open-offer-dialog")[0]; + expect(emittedData[0]).toEqual(["did:ethr:test:other", contact.name]); }); });