<commit_before>import * as fse from 'fs-extra';
import * as shell from 'shelljs';

describe('cp-cli', () => {
  afterEach(async () => {
    await Promise.all([fse.remove('out'), fse.remove('test/assets/bar.txt')]);
  });

  it('should print a help text when no arguments given', () => {
    const { stderr } = shell.exec('node bin/cp-cli');
    expect(stderr).not.toEqual('');
  });

  it('should print a help text when only one argument was given', () => {
    const { stderr } = shell.exec('node bin/cp-cli foo');
    expect(stderr).not.toEqual('');
  });

  it('should copy a source file to target dir', done => {
    const { stderr } = shell.exec(
      'node bin/cp-cli test/assets/foo.txt out/foo.txt',
    );
    expect(stderr).toEqual('');
    fse.stat('out/foo.txt', (err, stats) => {
      expect(err).toBeNull();
      expect(stats.isFile()).toEqual(true);
      done();
    });
  });

  it('should dereference symlinks', async () => {
    shell.cd('test/assets');
    shell.ln('-s', 'foo.txt', 'bar.txt');
    shell.cd('../..');
    const { stderr } = shell.exec('node bin/cp-cli -d test/assets out');
    expect(stderr).toEqual('');
    let stats = await fse.stat('out/foo.txt');
    expect(stats.isFile()).toEqual(true);
    stats = await fse.stat('out/bar.txt');
    expect(stats.isFile()).toEqual(true);
    expect(stats.isSymbolicLink()).toEqual(false);
  });

  it.only('should copy directory content', done => {
    const { stderr } = shell.exec('node bin/cp-cli test/assets out');
    expect(stderr).toEqual('');
    fse.stat('out/foo.txt', (err, stats) => {
      expect(err).toBeNull();
      expect(stats.isFile()).toEqual(true);
      done();
    });
  });
});<commit_msg>Removed .only in test 🗑<commit_after>import * as fse from 'fs-extra';
import * as shell from 'shelljs';

describe('cp-cli', () => {
  afterEach(async () => {
    await Promise.all([fse.remove('out'), fse.remove('test/assets/bar.txt')]);
  });

  it('should print a help text when no arguments given', () => {
    const { stderr } = shell.exec('node bin/cp-cli');
    expect(stderr).not.toEqual('');
  });

  it('should print a help text when only one argument was given', () => {
    const { stderr } = shell.exec('node bin/cp-cli foo');
    expect(stderr).not.toEqual('');
  });

  it('should copy a source file to target dir', done => {
    const { stderr } = shell.exec(
      'node bin/cp-cli test/assets/foo.txt out/foo.txt',
    );
    expect(stderr).toEqual('');
    fse.stat('out/foo.txt', (err, stats) => {
      expect(err).toBeNull();
      expect(stats.isFile()).toEqual(true);
      done();
    });
  });

  it('should dereference symlinks', async () => {
    shell.cd('test/assets');
    shell.ln('-s', 'foo.txt', 'bar.txt');
    shell.cd('../..');
    const { stderr } = shell.exec('node bin/cp-cli -d test/assets out');
    expect(stderr).toEqual('');
    let stats = await fse.stat('out/foo.txt');
    expect(stats.isFile()).toEqual(true);
    stats = await fse.stat('out/bar.txt');
    expect(stats.isFile()).toEqual(true);
    expect(stats.isSymbolicLink()).toEqual(false);
  });

  it('should copy directory content', done => {
    const { stderr } = shell.exec('node bin/cp-cli test/assets out');
    expect(stderr).toEqual('');
    fse.stat('out/foo.txt', (err, stats) => {
      expect(err).toBeNull();
      expect(stats.isFile()).toEqual(true);
      done();
    });
  });
});
{'fraction_non_alphanumeric': 0.21401236385045627, 'fraction_numerical': 0.0, 'mean_word_length': 3.1388550548112057, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '4398193', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1152, 'n_words': 232}