All files / app/assets/javascripts/related_issues/services related_issues_service.js

80% Statements 4/5
100% Branches 1/1
80% Functions 4/5
80% Lines 4/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35          19x       19x       4x                               1x          
import axios from '~/lib/utils/axios_utils';
import { linkedIssueTypesMap } from '../constants';
 
class RelatedIssuesService {
  constructor(endpoint) {
    this.endpoint = endpoint;
  }
 
  fetchRelatedIssues() {
    return axios.get(this.endpoint);
  }
 
  addRelatedIssues(newIssueReferences, linkType = linkedIssueTypesMap.RELATES_TO) {
    return axios.post(this.endpoint, {
      issuable_references: newIssueReferences,
      link_type: linkType,
    });
  }
 
  static saveOrder({ endpoint, move_before_id, move_after_id }) {
    return axios.put(endpoint, {
      epic: {
        move_before_id,
        move_after_id,
      },
    });
  }
 
  static remove(endpoint) {
    return axios.delete(endpoint);
  }
}
 
export default RelatedIssuesService;