Commit 76585993 authored by Mike Greiling's avatar Mike Greiling

fix race condition between service class and manually mocked store values

parent 30800334
import Vue from 'vue';
import relatedIssuesRoot from '~/issuable/related_issues/components/related_issues_root.vue';
import relatedIssuesService from '~/issuable/related_issues/services/related_issues_service.js';
const defaultProps = {
endpoint: '/foo/bar/issues/1/related_issues',
......@@ -41,11 +42,17 @@ describe('RelatedIssuesRoot', () => {
describe('methods', () => {
describe('onRelatedIssueRemoveRequest', () => {
beforeEach(() => {
beforeEach((done) => {
spyOn(relatedIssuesService.prototype, 'fetchRelatedIssues').and.returnValue(Promise.reject());
vm = new RelatedIssuesRoot({
propsData: defaultProps,
}).$mount();
vm.store.setRelatedIssues([issuable1]);
setTimeout(() => {
vm.store.setRelatedIssues([issuable1]);
done();
});
});
it('remove related issue and succeeds', (done) => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment