<commit_before>const assert = require('assert');
const createSync = require('../index');

describe('sync', function() {
  this.timeout(2000);

  it('executes all promises and streams out to success stream', (done) => {
    const sync = createSync({
      syncAction: (item) => {
        return new Promise((resolve, reject) => {
          resolve(item.id);
        });
      }
    });

    let counter = 0;

    sync.syncedItems.subscribe(x => {
      console.log('Received an item from the synced stream: ', x);
      counter++;
      if (counter === 2) {
        done();
      }
    });

    sync.queue({ id: 1 });
    sync.queue({ id: 2 });
  });


  it('when an item fails, it goes to the failed stream', (done) => {
    const sync = createSync({
      syncAction: (item) => {
        return new Promise((resolve, reject) => {
          reject(item.id);
        });
      },
      maxRetries: 0,
    });<commit_msg>removed console log from test<commit_after>const assert = require('assert');
const createSync = require('../index');

describe('sync', function() {
  this.timeout(2000);

  it('executes all promises and streams out to success stream', (done) => {
    const sync = createSync({
      syncAction: (item) => {
        return new Promise((resolve, reject) => {
          resolve(item.id);
        });
      }
    });

    let counter = 0;

    sync.syncedItems.subscribe(x => {
      // console.log('Received an item from the synced stream: ', x);
      counter++;
      if (counter === 2) {
        done();
      }
    });

    sync.queue({ id: 1 });
    sync.queue({ id: 2 });
  });


  it('when an item fails, it goes to the failed stream', (done) => {
    const sync = createSync({
      syncAction: (item) => {
        return new Promise((resolve, reject) => {
          reject(item.id);
        });
      },
      maxRetries: 0,
    });
{'fraction_non_alphanumeric': 0.16693591814754982, 'fraction_numerical': 0.009693053311793215, 'mean_word_length': 2.2256944444444446, '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': '6156944', 'n_tokens_mistral': 574, 'n_tokens_neox': 544, 'n_words': 154}