<commit_before>const assert = require('assert');

const UseCase = require('../../lib/UseCase');


describe('lib/UseCase', () => {
  describe('_promisifyResult', () => {
    it('should return a rejected promise if a error is passed', done => {
      UseCase._promisifyResult(new Error('ERR!'))
        .catch(err => {
          assert.strictEqual(err.message, 'ERR!');
          done();
        });
    });
  });
});<commit_msg>Add tests<commit_after>const assert = require('assert');

const UseCase = require('../../lib/UseCase');


describe('lib/UseCase', () => {
  describe('_promisifyResult', () => {
    it('should return a resolved promise if undefined is passed', done => {
      UseCase._promisifyResult(undefined)
        .then(result => {
          assert.strictEqual(result, undefined);
          done();
        })
    });

    it('should return a rejected promise if a error is passed', done => {
      UseCase._promisifyResult(new Error('ERR!'))
        .catch(err => {
          assert.strictEqual(err.message, 'ERR!');
          done();
        })
      ;
    });

    it('should continue chaining promises if a resolved promise is passed', done => {
      UseCase._promisifyResult(Promise.resolve(123))
        .then(result => {
          assert.strictEqual(result, 123);
          done();
        })
    });

    it('should continue chaining promises if a rejected promise is passed', done => {
      UseCase._promisifyResult(Promise.reject(456))
        .catch(result => {
          assert.strictEqual(result, 456);
          done();
        })
    });
  });
});
{'fraction_non_alphanumeric': 0.16455696202531644, 'fraction_numerical': 0.007594936708860759, 'mean_word_length': 2.4671052631578947, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '6232157', 'n_tokens_mistral': 460, 'n_tokens_neox': 442, 'n_words': 98}