All files / app/assets/javascripts/vue_merge_request_widget/stores get_state_key.js

96.77% Statements 30/31
95.45% Branches 42/44
100% Functions 1/1
96.77% Lines 30/31

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 36 37      22x 1x 21x   21x 1x 20x 1x 19x 1x 18x 1x 17x 2x 15x 1x 14x 1x 13x 1x 12x 1x 11x 2x 9x 1x 8x 3x 5x 1x   4x    
import { stateKey } from './state_maps';
 
export default function deviseState() {
  if (!this.commitsCount) {
    return stateKey.nothingToMerge;
  } else Iif (this.hasMergeChecksFailed && !this.autoMergeEnabled) {
    return stateKey.mergeChecksFailed;
  } else if (this.projectArchived) {
    return stateKey.archived;
  } else if (this.branchMissing) {
    return stateKey.missingBranch;
  } else if (this.mergeStatus === 'unchecked' || this.mergeStatus === 'checking') {
    return stateKey.checking;
  } else if (this.hasConflicts) {
    return stateKey.conflicts;
  } else if (this.shouldBeRebased) {
    return stateKey.rebase;
  } else if (this.onlyAllowMergeIfPipelineSucceeds && this.isPipelineFailed) {
    return stateKey.pipelineFailed;
  } else if (this.draft) {
    return stateKey.draft;
  } else if (this.hasMergeableDiscussionsState && !this.autoMergeEnabled) {
    return stateKey.unresolvedDiscussions;
  } else if (this.isPipelineBlocked) {
    return stateKey.pipelineBlocked;
  } else if (this.canMerge && this.isSHAMismatch) {
    return stateKey.shaMismatch;
  } else if (this.autoMergeEnabled && !this.mergeError) {
    return stateKey.autoMergeEnabled;
  } else if (!this.canMerge && !window.gon?.features?.restructuredMrWidget) {
    return stateKey.notAllowedToMerge;
  } else if (this.canBeMerged) {
    return stateKey.readyToMerge;
  }
  return null;
}