<commit_before>import promiseWrapper from './promise-wrapper';

const someApi = {
  methodA: () => {}
};
describe('promiseWrapper', () => {
  it('Should return a promise', () => {
    expect(promiseWrapper(someApi, 'methodA', {})).toBeInstanceOf(Promise);
  });
});<commit_msg>Added real tests for promise-wrapper<commit_after>import promiseWrapper from './promise-wrapper';

const pinkPony = {pink: 'pony'};
const deadPony = new Error('dead pony');
const someApi = {
  methodA: () => {},
  methodB: (params, cb) => cb(null, pinkPony)
};
describe('promiseWrapper', () => {
  it('Should return a promise', () => {
    expect(promiseWrapper(someApi, 'methodA', {})).toBeInstanceOf(Promise);
  });
  it('Should resolve with callback value', () => {
    promiseWrapper(someApi, 'methodB', {})
      .then(data => expect(data).toEqual(pinkPony));
  });
  it('Should reject with callback error', () => {
    promiseWrapper(someApi, 'methodB', {})
      .catch(err => expect(err).toBe(deadPony))
  });
  it('Should reject with when calling undefined methods', () => {
    promiseWrapper(someApi, 'methodZ', {})
      .catch(err => expect(err).toBeDefined())
  });
});
{'fraction_non_alphanumeric': 0.19913793103448277, 'fraction_numerical': 0.0, 'mean_word_length': 4.635922330097087, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, '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': '3280474', 'n_tokens_mistral': 365, 'n_tokens_neox': 368, 'n_words': 77}