What is the value of harness.subject when you call harness.getContactSummary()?
I would expect that this card would display if the harness.subject has the properties type: 'contact', contact_type: 'household_member'. If this is not a properly formatted contact document, or if it is a contact with a different type then I would expect the card to not display.
If you don’t want to change the test’s subject for whatever reason - there is also an option to provide the contact you are calculating a summary for. See the optional parameters on getContactSummary
Thank you @kenn
My harness .subject has the properties type: 'contact', contact_type: 'household_member' but still harness.getContactSummary(); returns { cards: [], fields: [], context: {} }
That’s an interesting scenario you present. I would spend time to dig into the various components that might lead to what you are observing.
Ensure that your subject, likely defaulting to one set in harness.defaults.json has the same contact_type ID expected in appliesToType of your card.
Check that the condition you pass in appliesIf is satisfied by your test case. For example, if you are testing a card that applies to contacts over 5 years, you would have to set the date_of_birth attribute of your harness contact to a date that results in age over 5 years lest your get an empty cards array. In addition to that, if you proceed to check nested card components such as fields on a card that actually does not exist, the test will further fail because of an attempt to extract attributes of null.
Check that you are handling objects such as null or undefined that you further use to extract values you use with fields in your card. For instance, an attempt to use getField(report, field) (see Utils) on a non-existing report will easily get messy when you run tests. Of course you will get a descriptive error message when you attempt such, but just ensure you handle such exceptions before they affect the card.
Let us know how it goes, and share snippets to help narrow down the issue.
Thanks @kitsao and @kenn
This is how my card looks like @kenn Above snippet doesn’t return cards as we want to. @kitsao My subject in harness.defaults.json has the following properties