<commit_before>import { expect } from 'chai';
import proxyquire from 'proxyquire';
import sinon from 'sinon';

describe('asyncOra', () => {
  let asyncOra;
  let MockOra;
  let currentOra;

  beforeEach(() => {
    currentOra = undefined;
    MockOra = (text) => {
      currentOra = {
        start() {
          this.started = true;
          return currentOra;
        },
        succeed() {
          this.succeeded = true;
          return currentOra;
        },
        fail() {
          this.failed = true;
          return currentOra;
        },
        get text() {
          return currentOra._text;
        },
        set text(newText) {
          currentOra._text = newText;
        },
      };
      currentOra.succeeded = false;
      currentOra.failed = false;
      currentOra._text = text;
      return currentOra;
    };
    asyncOra = proxyquire.noCallThru().load('../../src/util/ora-handler', {
      ora: { ora: MockOra },
    }).default;
  });

  it('should create an ora with an initial value', () => {
    asyncOra('say this first', async () => {});
    expect(currentOra).to.not.equal(undefined);
    expect(currentOra.text).to.equal('say this first');
  });

  it('should not create an ora when in non-interactive mode', () => {
    asyncOra.interactive = false;
    asyncOra('say this again', async () => {});
    expect(currentOra).to.equal(undefined);
  });

  it('should call the provided async function', async () => {
    const spy = sinon.spy();
    await asyncOra('random text', async () => {
      spy();
    });<commit_msg>fix(tests): update tests due to changes in #101<commit_after>import { expect } from 'chai';
import proxyquire from 'proxyquire';
import sinon from 'sinon';

describe('asyncOra', () => {
  let asyncOra;
  let MockOra;
  let currentOra;

  beforeEach(() => {
    currentOra = undefined;
    MockOra = (text) => {
      currentOra = {
        start() {
          this.started = true;
          return currentOra;
        },
        succeed() {
          this.succeeded = true;
          return currentOra;
        },
        fail() {
          this.failed = true;
          return currentOra;
        },
        get text() {
          return currentOra._text;
        },
        set text(newText) {
          currentOra._text = newText;
        },
      };
      currentOra.succeeded = false;
      currentOra.failed = false;
      currentOra._text = text;
      return currentOra;
    };
    asyncOra = proxyquire.noCallThru().load('../../src/util/ora-handler', {
      './ora': MockOra,
    }).default;
  });

  it('should create an ora with an initial value', () => {
    asyncOra('say this first', async () => {});
    expect(currentOra).to.not.equal(undefined);
    expect(currentOra.text).to.equal('say this first');
  });

  it('should not create an ora when in non-interactive mode', () => {
    asyncOra.interactive = false;
    asyncOra('say this again', async () => {});
    expect(currentOra).to.equal(undefined);
  });

  it('should call the provided async function', async () => {
    const spy = sinon.spy();
    await asyncOra('random text', async () => {
      spy();
    });
{'fraction_non_alphanumeric': 0.15084153699587172, 'fraction_numerical': 0.000952683391552874, 'mean_word_length': 2.204476093591048, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '3196121', 'n_tokens_mistral': 994, 'n_tokens_neox': 977, 'n_words': 224}