"Using the Apex Wire Adapter" error: "TypeError: getAccountList.emit is not a function"
- "Using the Apex Wire Adapter" error: "TypeError: getAccountList.emit is not a function"
- 【Salesforce】Trailheadの Jest モック(Apexワイヤーアダプター)サンプルコードの誤り
Try this
import getAccountList from '@salesforce/apex/AccountController.getAccountList';
jest.mock(
'@salesforce/apex/AccountController.getAccountList',
()=>{
const { createApexTestWireAdapter } = require("@salesforce/sfdx-lwc-jest");
return {
default: createApexTestWireAdapter(jest.fn()),
};
},
{virtual: true}
);
In the test class, execute the following emit ()
getAccountList.emit(mockGetAccountList);
インストールできていない?
I've changed the default package.json to use eslint ^8.57.0 like eslint-plugin-lwc does for now and it's working.