<commit_before>import {consoleLogger} from 'tocco-util'
import {externalEvents} from 'tocco-app-extensions'
import {takeEvery, call, select, put, all} from 'redux-saga/effects'

import sendDwrRequest from '../../utils/Dwr'
import createMergeResult from '../../utils/MergeActionResult'
import {SAVE_MERGE, setMergeResponse} from './actions'
import {mergingWithoutProblems} from '../../utils/MergeResponse'

export function sendDwr(mergeActionResult) {
  if (__DEV__) {
    // eslint-disable-next-line no-console
    console.log('dev mode. would send dwr', mergeActionResult, JSON.stringify(mergeActionResult))
    return new Promise(resolve => {
      return resolve(require('../../dev/response.json'))
    })
  } else {
    return sendDwrRequest('nice2_entityoperation_MergeEntitiesService', 'merge', mergeActionResult)
  }
}

export function* save() {
  try {
    const state = yield select()
    const mergeActionResult = yield call(createMergeResult, state)
    const mergeResponse = yield call(sendDwr, mergeActionResult)

    if (mergingWithoutProblems(mergeResponse)) {
      yield put(externalEvents.fireExternalEvent('close'))
    } else {
      yield put(setMergeResponse(mergeResponse))
    }
  } catch (error) {
    consoleLogger.logError('An error occurred during merge:', error)
  }
}

export default function* sagas() {
  yield all([
    takeEvery(SAVE_MERGE, save)
  ])
}
<commit_msg>fix(merge): do not mock requests in DEV mode if `noMock` option set<commit_after>import {consoleLogger} from 'tocco-util'
import {externalEvents} from 'tocco-app-extensions'
import {takeEvery, call, select, put, all} from 'redux-saga/effects'

import sendDwrRequest from '../../utils/Dwr'
import createMergeResult from '../../utils/MergeActionResult'
import {SAVE_MERGE, setMergeResponse} from './actions'
import {mergingWithoutProblems} from '../../utils/MergeResponse'

export function sendDwr(mergeActionResult) {
  if (__DEV__ && !__NO_MOCK__) {
    // eslint-disable-next-line no-console
    console.log('dev mode. would send dwr', mergeActionResult, JSON.stringify(mergeActionResult))
    return new Promise(resolve => {
      return resolve(require('../../dev/response.json'))
    })
  } else {
    return sendDwrRequest('nice2_entityoperation_MergeEntitiesService', 'merge', mergeActionResult)
  }
}

export function* save() {
  try {
    const state = yield select()
    const mergeActionResult = yield call(createMergeResult, state)
    const mergeResponse = yield call(sendDwr, mergeActionResult)

    if (mergingWithoutProblems(mergeResponse)) {
      yield put(externalEvents.fireExternalEvent('close'))
    } else {
      yield put(setMergeResponse(mergeResponse))
    }
  } catch (error) {
    consoleLogger.logError('An error occurred during merge:', error)
  }
}

export default function* sagas() {
  yield all([
    takeEvery(SAVE_MERGE, save)
  ])
}

{'fraction_non_alphanumeric': 0.12482566248256625, 'fraction_numerical': 0.000697350069735007, 'mean_word_length': 4.33271375464684, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7648247', 'n_tokens_mistral': 853, 'n_tokens_neox': 843, 'n_words': 208}