Open cnotv opened 1 year ago
Example case which may work in some cases (it did not for mine):
Thanks @torchiaf https://github.com/rancher/dashboard/pull/10493/files#diff-6321b8c64f34671df66c6092445640b8e9da0a2b208c02190f96896f7ab0cb3bR46-R53
it('should show apps catalog', async() => {
const wrapper = shallowMount(ClusterTools, mountOptions);
await (ClusterTools as any).fetch.call(wrapper.vm);
const cards = wrapper.find('[data-testid^="cluster-tools-app"]');
expect(cards.exists()).toBe(true);
});
This issue may be solved with https://github.com/rancher/dashboard/issues/9711
Describe
During the development of a trivial fix, it showed up the need to setup Jest for Nuxt functionalities, such like
$fetch
.This may be avoided in case of cleaning up leftover logic https://github.com/rancher/dashboard/issues/9711 and stick to Vue lifecycle hooks.
NOTE: This is not an issue about async, rather a lack of the hook implementation in the
vue-test-utils
.