<commit_before>'use strict';

const { describe, it } = require('../helpers/mocha');
const { expect } = require('../helpers/chai');
const sinon = require('sinon');
const {
  buildTmp,
  processExit,
  fixtureCompare: _fixtureCompare
} = require('git-fixtures');
const { isGitClean } = require('git-diff-apply');
const emberCliUpdate = require('../../src');
const {
  assertNoUnstaged
} = require('../helpers/assertions');
const { initBlueprint } = require('../helpers/blueprint');
const loadSafeBlueprintFile = require('../../src/load-safe-blueprint-file');
const { defaultTo } = require('../../src/constants');

describe(function() {
  this.timeout(30 * 1000);

  let tmpPath;

  afterEach(function() {
    sinon.restore();
  });

  async function merge({
    fixturesPath,
    dirty,
    blueprint,
    from,
    to = '3.11.0-beta.1',
    reset,
    commitMessage,
    beforeMerge = () => Promise.resolve(),
    afterMerge = () => Promise.resolve()
  }) {
    tmpPath = await buildTmp({
      fixturesPath,
      dirty
    });

    await beforeMerge();

    let promise = (async() => {
      let result = await (await emberCliUpdate({
        cwd: tmpPath,
        blueprint,
        from,
        to,
        reset
      })).promise;

      await afterMerge();

      return result;
    })();

    return await processExit({
      promise,
      cwd: tmpPath,
      commitMessage,
      expect
    });
  }

  function fixtureCompare({
    mergeFixtures
  }) {
    let actual = tmpPath;
    let expected = mergeFixtures;

    _fixtureCompare({
      expect,
      actual,
      expected
    });
  }

  it('handles dirty', async function() {
    let {<commit_msg>remove unused reset<commit_after>'use strict';

const { describe, it } = require('../helpers/mocha');
const { expect } = require('../helpers/chai');
const sinon = require('sinon');
const {
  buildTmp,
  processExit,
  fixtureCompare: _fixtureCompare
} = require('git-fixtures');
const { isGitClean } = require('git-diff-apply');
const emberCliUpdate = require('../../src');
const {
  assertNoUnstaged
} = require('../helpers/assertions');
const { initBlueprint } = require('../helpers/blueprint');
const loadSafeBlueprintFile = require('../../src/load-safe-blueprint-file');
const { defaultTo } = require('../../src/constants');

describe(function() {
  this.timeout(30 * 1000);

  let tmpPath;

  afterEach(function() {
    sinon.restore();
  });

  async function merge({
    fixturesPath,
    dirty,
    blueprint,
    from,
    to = '3.11.0-beta.1',
    commitMessage,
    beforeMerge = () => Promise.resolve(),
    afterMerge = () => Promise.resolve()
  }) {
    tmpPath = await buildTmp({
      fixturesPath,
      dirty
    });

    await beforeMerge();

    let promise = (async() => {
      let result = await (await emberCliUpdate({
        cwd: tmpPath,
        blueprint,
        from,
        to
      })).promise;

      await afterMerge();

      return result;
    })();

    return await processExit({
      promise,
      cwd: tmpPath,
      commitMessage,
      expect
    });
  }

  function fixtureCompare({
    mergeFixtures
  }) {
    let actual = tmpPath;
    let expected = mergeFixtures;

    _fixtureCompare({
      expect,
      actual,
      expected
    });
  }

  it('handles dirty', async function() {
    let {
{'fraction_non_alphanumeric': 0.15547489413188142, 'fraction_numerical': 0.006654567453115548, 'mean_word_length': 2.582881906825569, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '496858', 'n_tokens_mistral': 1047, 'n_tokens_neox': 1022, 'n_words': 220}