How to find component, passed as slot into child component, in jest?

Viewed 136

I have a component, that uses another 'wrapper' component and passing all of it's body as slots into it.
Something like that:

<template>
   <WrapperComponent>
      <Card />
   </WrapperComponent>
</template>

Question is - how do I find this 'Card' component while testing parent component in jest?
Have tried like that, but failed:

describe('RegistrationModal', () => {
    const wrapper = mount(RegistrationModal, {
        localVue
    });
    test('Registration of private company', async () => {
        const PrivateCard = wrapper.findAllComponents(Card).at(0);
        await PrivateCard.trigger('click', ['private'] );
        expect(wrapper.vm.action).toBe('private');
        expect(wrapper.vm.step).toBe(1);
    });
});
0 Answers
Related