Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('remove related issue and succeeds', () => {
mock.onDelete(issuable1.referencePath).reply(200, { issues: [] });
wrapper.vm.onRelatedIssueRemoveRequest(issuable1.id);
return axios.waitForAll().then(() => {
expect(wrapper.vm.state.relatedIssues).toEqual([]);
});
});
it('remove related issue, fails, and restores to related issues', () => {
mock.onDelete(issuable1.referencePath).reply(422, {});
wrapper.vm.onRelatedIssueRemoveRequest(issuable1.id);
return axios.waitForAll().then(() => {
expect(wrapper.vm.state.relatedIssues).toHaveLength(1);
expect(wrapper.vm.state.relatedIssues[0].id).toEqual(issuable1.id);
});
});
});