0👍
Getters are cached so I needed to implement the mock getter using reactive state instead of mockReturnValue:
test('Dispatches fetchAccount when defaultInternalAccountId is updated', () => {
const accountId = '1234';
const accountId2 = '5678';
const vm = new Vue({ data: { accountId } });
mockDefaultInternalAccountId.mockImplementation(() => vm.accountId);
shallowMount(AssetAllocationsSummaryContainer, {
localVue,
store,
});
expect(mockFetchAccount.mock.calls[0][1]).toEqual({ accountId });
vm.accountId = accountId2;
expect(mockFetchAccount).toHaveBeenCalledTimes(2);
expect(mockFetchAccount.mock.calls[1][1]).toEqual({ accountId: accountId2 });
});
- [Vuejs]-Asp.net core 3.1 backend does not get the Identity from cookie
- [Vuejs]-Html within Javascript
Source:stackexchange.com