registerEndpoint requires multiple flushPromises
take this code for instance... if I only use 1 flushPromises, the expect won't work.
Is it expected ?
Is there a workaround ?
thanks !
registerEndpoint('/api/channel/1', {
method: 'DELETE',
handler: () => {
return {};
},
});
describe('ChannelMenu', () => {
it('deletes a channel', async () => {
const wrapper = mountWrapper();
const deleteState = useState(DELETE_CHANNEL_ID);
wrapper.vm.deleteChannel();
await flushPromises();
await flushPromises();
expect(deleteState.value).toBe(wrapper.vm.props.channel.idChannel);
});
});