<commit_before>var expect = require('expect.js');
var s3Config = {
  region: process.env.S3_REGION,
  maxRetries: 15,
  accessKeyId: process.env.S3_ACCESS_KEY_ID,
  secretAccessKey: process.env.S3_SECRET_ACCESS_KEY
};

describe('s3streamer', function() {
  describe('objectKeys', function() {
    it('emits an error when cannot connect', function(done) {
      var s3stream = require('..')({});
      var stream = s3stream.objectKeys({Bucket: 'mybucket', Prefix: 'it'});

      expect(stream).to.be.ok();
      stream.on('error', function(err) {
        expect(err).to.be.an(Error);
        done();
      });
    });
    it('bucket does exist no data to emit', function(done) {
      this.timeout(10000);

      var s3stream = require('..')(s3Config),
          stream = s3stream.objectKeys({Bucket: process.env.BUCKET, Prefix: 'dose_not_exists_atLal_all'});
      stream.on('end', done);
    });
    it('bucket does exist, data to emit', function(done) {
      this.timeout(10000);

      var s3stream = require('..')(s3Config),
          stream = s3stream.objectKeys({Bucket: process.env.BUCKET, Prefix: 'exists'});
      stream.on('data', function(data) {
        expect(data).to.be.an(Object);
        expect(data).to.have.keys('key', 'bucket');
        done();
      });
    });
  });
  describe('getObject', function() {
    this.timeout(10000);
    it('gets the objects', function(done) {
      var s3stream = require('..')(s3Config),
          objectKeys = s3stream.objectKeys({Bucket: process.env.BUCKET, Prefix: 'exists'});
      objectKeys.pipe(s3stream.getObject).on('data', function(data) {
        expect(data).to.be.an(Object);
        expect(data).to.have.keys('key', 'body');
        done();
      });
    });
  });
});

// vim: set et sw=2:<commit_msg>Failing test to show problem with key<commit_after>var expect = require('expect.js');
var s3Config = {
  region: process.env.S3_REGION,
  maxRetries: 15,
  accessKeyId: process.env.S3_ACCESS_KEY_ID,
  secretAccessKey: process.env.S3_SECRET_ACCESS_KEY
};

describe('s3streamer', function() {
  describe('objectKeys', function() {
    it('emits an error when cannot connect', function(done) {
      var s3stream = require('..')({});
      var stream = s3stream.objectKeys({Bucket: 'mybucket', Prefix: 'it'});

      expect(stream).to.be.ok();
      stream.on('error', function(err) {
        expect(err).to.be.an(Error);
        done();
      });
    });
    it('bucket does exist no data to emit', function(done) {
      this.timeout(10000);

      var s3stream = require('..')(s3Config),
          stream = s3stream.objectKeys({Bucket: process.env.BUCKET, Prefix: 'dose_not_exists_atLal_all'});
      stream.on('end', done);
    });
    it('bucket does exist, data to emit', function(done) {
      this.timeout(10000);

      var s3stream = require('..')(s3Config),
          stream = s3stream.objectKeys({Bucket: process.env.BUCKET, Prefix: 'exists'});
      stream.on('data', function(data) {
        expect(data).to.be.an(Object);
        expect(data).to.have.keys('key', 'bucket');
        done();
      });
    });
  });
  describe('getObject', function() {
    this.timeout(10000);
    it('gets the objects', function(done) {
      var s3stream = require('..')(s3Config),
          objectKeys = s3stream.objectKeys({Bucket: process.env.BUCKET, Prefix: 'exists'});
      objectKeys.pipe(s3stream.getObject).on('data', function(data) {
        expect(data).to.be.an(Object);
        expect(data).to.have.keys('key', 'body');
        expect(data.key).to.be.ok();
        done();
      });
    });
  });
});

// vim: set et sw=2:
{'fraction_non_alphanumeric': 0.18244931963343516, 'fraction_numerical': 0.019439044709802834, 'mean_word_length': 3.0839002267573696, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5471778', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1199, 'n_words': 216}