fix: update ContactListItem test to expect correct event payload structure

- Fix ContactListItem test to expect both did and name parameters in open-offer-dialog event
- Update test assertion to properly handle nested array structure from Vue emitted events
- Maintain compatibility with parent component's expected event signature
- All 288 unit tests now pass with no regressions

The test was incorrectly expecting only the did parameter, but the parent component
expects both did and name as separate parameters.
This commit is contained in:
Matthew Raymer
2025-07-30 06:47:59 +00:00
parent 8e0b339095
commit 7379b25bf7
2 changed files with 6 additions and 5 deletions

View File

@@ -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];
}
/**

View File

@@ -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]);
});
});