I have been working through trailhead from link below https://trailhead.salesforce.com/en/content/learn/modules/test-lightning-web-components
and noticed I got a console.warn error
console.warn registerApexTestWireAdapter is deprecated. More details: https://github.com/salesforce/wire-service-jest-util/blob/master/docs/migrating-from-version-2.x-to-3.x.md
I looked over the documentation was a little unsure of how to proceeded with it. If registerApexTestWireAdapter is deprecated would I be safe to assume that it should not be used in a project? Also if I wanted to do a jest test for a LWC component that was say as simple as the code shown below. What would be the desired alternative to not receive an console.warn message?
@wire(Contacts)contacts;
what would be the desired alternative to
import { registerApexTestWireAdapter } from '@salesforce/sfdx-lwc-jest';
import getContacts from '@salesforce/apex/practiceLWCController.getContacts';
// ...test below here
it('displays contacts', () => {
const element = createElement('practice-lwc', {
is: PracticeLWC
});
document.body.appendChild(element);
getContactsAdapter.emit(mockContacts);
return Promise.resolve().then(() => {
const contacts = Array.from(element.shadowRoot.querySelectorAll('.contact'));
expect(contacts.length).toBe(3);
})
});