Tengo un método en el componente Vue con fetch, cómo verificar con jest + vtu
expect(wrapper.vm.collectionRelatedEntries).toEqual('related_entries')
O algo más en then(() => { //haz algo más })
requestRemoveEntry(url){ this.addPreloader = true return fetch(url, { method: 'DELETE', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(this.selectedIdEntries) }) .then(response => { if(response.ok){ if(response.status === 204){ this.selectedIdEntries = [] this.stateSelected = false } if(response.status === 200){ return response.json().then((data) => { this.collectionRelatedEntries = data.related_entries }) } }else { this.isShowModalError = true } }) .then(() => { //do something else }) .catch((error) => { this.isShowModalError = true }) .finally(() => this.addPreloader = false) }, test('test method for remove entry', async () => { global.fetch = jest.fn(() => Promise.resolve({data: [{ 'title': 'title', id: 'id', related_entries: ['related_entries'] }], ok: true, status: 200})); wrapper.setData({ statusMassDelete: false }) await wrapper.vm.requestRemoveEntry('/api/get_entries', 'id') expect(fetch).toHaveBeenCalledWith("/api/get_entries", {"body": null, "headers": {"Content-Type": "application/json"}, "method": "DELETE"})expect(wrapper.vm.collectionRelatedEntries).toEqual('related_entries') })