<commit_before>const {assert} = require ('chai');
const {Uploader} = require ('../src/uploader');

describe ('Setup file upload test', function () {
  let source = undefined;
  let uploader = undefined;

  const objectParams = {ContentType: 'text/csv'};

  before (function (done) {
    source = new Buffer ('key;value\ntest;1\nexample;2\n');

    uploader = new Uploader ({
      accessKey: 'test-accessKey',
      secretKey: 'test-secretKey',
      bucket: 'test-bucket',
      objectName: 'testfile1',
      objectParams,
      stream: source,
      debug: true,
    });
    return done ();
  });

  it ('I have set accessKey', () =>
    assert.equal (
      uploader.upload.service.config.credentials.accessKeyId,
      'test-accessKey'
    ));

  it ('I have set bucket', () =>
    assert.equal (uploader.objectParams.Bucket, 'test-bucket'));

  it ('I have set key', () =>
    assert.equal (uploader.objectParams.Key, 'testfile1'));

  it ('I have set ContentType', () =>
    assert.equal (uploader.objectParams.ContentType, 'text/csv'));

  it ('I have set debug', () => assert.ok (uploader.debug));

  describe ('Creating a second uploader', function () {
    let uploader2 = undefined;

    before (() => {
      return (uploader2 = new Uploader ({
        bucket: 'test-bucket-2',
        stream: new Buffer ('...\n'),
        objectParams,
      }));
    });

    it ('I have set bucket', () =>
      assert.equal (uploader2.objectParams.Bucket, 'test-bucket-2'));

    it ('I have not unset original bucket', () =>
      assert.equal (uploader.objectParams.Bucket, 'test-bucket'));
  });
});<commit_msg>test: remove deprecated new Buffer<commit_after>const { assert } = require('chai');
const { Uploader } = require('../src/uploader');

describe('Setup file upload test', function() {
  let source = undefined;
  let uploader = undefined;

  const objectParams = { ContentType: 'text/csv' };

  before(function(done) {
    source = Buffer.from('key;value\ntest;1\nexample;2\n');

    uploader = new Uploader({
      accessKey: 'test-accessKey',
      secretKey: 'test-secretKey',
      bucket: 'test-bucket',
      objectName: 'testfile1',
      objectParams,
      stream: source,
      debug: true,
    });
    return done();
  });

  it('I have set accessKey', () =>
    assert.equal(
      uploader.upload.service.config.credentials.accessKeyId,
      'test-accessKey',
    ));

  it('I have set bucket', () =>
    assert.equal(uploader.objectParams.Bucket, 'test-bucket'));

  it('I have set key', () =>
    assert.equal(uploader.objectParams.Key, 'testfile1'));

  it('I have set ContentType', () =>
    assert.equal(uploader.objectParams.ContentType, 'text/csv'));

  it('I have set debug', () => assert.ok(uploader.debug));

  describe('Creating a second uploader', function() {
    let uploader2 = undefined;

    before(() => {
      return (uploader2 = new Uploader({
        bucket: 'test-bucket-2',
        stream: Buffer.from('...\n'),
        objectParams,
      }));
    });

    it('I have set bucket', () =>
      assert.equal(uploader2.objectParams.Bucket, 'test-bucket-2'));

    it('I have not unset original bucket', () =>
      assert.equal(uploader.objectParams.Bucket, 'test-bucket'));
  });
});
{'fraction_non_alphanumeric': 0.1707920792079208, 'fraction_numerical': 0.005569306930693069, 'mean_word_length': 3.0362047440699125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '1033662', 'n_tokens_mistral': 1019, 'n_tokens_neox': 991, 'n_words': 235}